From 96fc4021d8473bd0c8d21962a677a85ce217e4f5 Mon Sep 17 00:00:00 2001 From: Nicola Carminati Date: Wed, 7 Nov 2018 12:19:37 +0100 Subject: [PATCH 1/3] Fix Graphic selection on Windows10 --- Client/Client.csproj | 5 ++-- Client/Program.cs | 43 +++++++++++++++++++++++++++-- Client/View/MainForm.cs | 1 + Client/View/OpeningForm.Designer.cs | 2 +- Client/packages.config | 12 ++++---- Step.Model/Constants.cs | 4 +-- 6 files changed, 54 insertions(+), 13 deletions(-) diff --git a/Client/Client.csproj b/Client/Client.csproj index ff37d7d7..f9ac962c 100644 --- a/Client/Client.csproj +++ b/Client/Client.csproj @@ -7,7 +7,7 @@ {66FA29DB-925A-402B-A4C7-D3D780FB1BC3} WinExe CMS_Client - CMS-Active Client + CMS_Client v4.6.2 512 true @@ -78,7 +78,7 @@ ..\Step\bin\Client\x64\ DEBUG;TRACE full - x86 + x64 prompt MinimumRecommendedRules.ruleset true @@ -137,6 +137,7 @@ + diff --git a/Client/Program.cs b/Client/Program.cs index de198cd8..16bb15bc 100644 --- a/Client/Program.cs +++ b/Client/Program.cs @@ -5,12 +5,14 @@ using Chromium.WebBrowser.Event; using Client.Config; using Client.Utils; using CMS_Client.View; +using Microsoft.Win32; using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; +using System.Management; using System.Reflection; using System.Threading; using System.Threading.Tasks; @@ -32,6 +34,9 @@ namespace CMS_Client { //Crate General Exception Handler AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(GeneralExMethod); + + //Crate General Exception Handler + AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(GeneralExMethod); //Read App Configuration readConfiguration(); @@ -58,7 +63,10 @@ namespace CMS_Client ShowAlarmAndClose("Only one istance of " + Application.ProductName + " can be executed!"); Application.EnableVisualStyles(); - Application.SetCompatibleTextRenderingDefault(false); + Application.SetCompatibleTextRenderingDefault(false); + + //Check Graphic Card in Energy Saving mode + checkGraphicCard(); //Run the Loading Form Application.Run(new OpeningForm()); @@ -89,7 +97,37 @@ namespace CMS_Client } } - + static private void checkGraphicCard() + { + + ManagementObjectSearcher VideoCardsQuery = new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_VideoController"); + ManagementObjectCollection VideoCards = VideoCardsQuery.Get(); + //Check if i have more Cards + if (VideoCards.Count > 1) + { + //Prepare List of Cards + String Cardlist = ""; + foreach (ManagementObject card in VideoCards){ + Cardlist = Cardlist + " - " + card["Name"] + "\n"; + } + + //If is Win 10 check the Registry Key + if (Environment.OSVersion.Version.Major == 10) + { + string keyName = @"HKEY_CURRENT_USER\Software\Microsoft\DirectX\UserGpuPreferences"; + string valueName = System.Reflection.Assembly.GetExecutingAssembly().Location; + Object value = Registry.GetValue(keyName, valueName, null); + if (value == null || !value.Equals("GpuPreference=1;")) + { + //code if key Not Exist add it and restart + Registry.SetValue(keyName, valueName, "GpuPreference=1;"); + MessageBox.Show("CMS Active has foundthis Graphic Cards:\n\n" + Cardlist +"\nThe graphic configuration has been setted. Press Ok to restart the Application",Application.ProductName); + Application.Restart(); + Environment.Exit(0); + } + } + } + } #endregion /////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -203,5 +241,6 @@ namespace CMS_Client } #endregion + } } diff --git a/Client/View/MainForm.cs b/Client/View/MainForm.cs index 92cef780..b928d794 100644 --- a/Client/View/MainForm.cs +++ b/Client/View/MainForm.cs @@ -37,6 +37,7 @@ namespace CMS_Client.View //Instance Method public MainForm() { + LdFrm = new LoadingForm(); LdFrm.Owner = this; diff --git a/Client/View/OpeningForm.Designer.cs b/Client/View/OpeningForm.Designer.cs index dd268192..9fc9b6d1 100644 --- a/Client/View/OpeningForm.Designer.cs +++ b/Client/View/OpeningForm.Designer.cs @@ -101,7 +101,7 @@ this.CloseLabel.Margin = new System.Windows.Forms.Padding(3, 0, 2, 0); this.CloseLabel.Name = "CloseLabel"; this.CloseLabel.Padding = new System.Windows.Forms.Padding(0, 0, 5, 0); - this.CloseLabel.Size = new System.Drawing.Size(47, 57); + this.CloseLabel.Size = new System.Drawing.Size(47, 31); this.CloseLabel.TabIndex = 3; this.CloseLabel.Text = "X"; this.CloseLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight; diff --git a/Client/packages.config b/Client/packages.config index 1639f044..b31b7df6 100644 --- a/Client/packages.config +++ b/Client/packages.config @@ -1,7 +1,7 @@ - - - - - - + + + + + + \ No newline at end of file diff --git a/Step.Model/Constants.cs b/Step.Model/Constants.cs index 4187638e..bc26fccb 100644 --- a/Step.Model/Constants.cs +++ b/Step.Model/Constants.cs @@ -221,8 +221,8 @@ namespace Step.Model } // File paths - public const string CLIENT_EXE_NAME = @"CMS-Active Client.exe"; - public const string CLIENT_EXE_NAME_NOEXT = @"CMS-Active Client"; + public const string CLIENT_EXE_NAME = @"CMS_Client.exe"; + public const string CLIENT_EXE_NAME_NOEXT = @"CMS_Client"; public const string MAINTENANCE_ATTACHMENT_PATH = @"C:\CMS\STEP\attachment\maintenance\"; public const string ALARM_ATTACHMENT_PATH = @"C:\CMS\STEP\attachment\alarm\"; From 5fb68fb851ba59eff8f66d0830da54a1ebcd8582 Mon Sep 17 00:00:00 2001 From: Nicola Carminati Date: Wed, 7 Nov 2018 16:17:33 +0100 Subject: [PATCH 2/3] Axes softkeys managed by "axesSoftkeys" functionality --- Step/wwwroot/src/components/under-the-hood.vue | 2 +- Step/wwwroot/src/modules/axes-softkeys.vue | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/Step/wwwroot/src/components/under-the-hood.vue b/Step/wwwroot/src/components/under-the-hood.vue index 770938d7..b767262f 100644 --- a/Step/wwwroot/src/components/under-the-hood.vue +++ b/Step/wwwroot/src/components/under-the-hood.vue @@ -15,7 +15,7 @@
- + diff --git a/Step/wwwroot/src/modules/axes-softkeys.vue b/Step/wwwroot/src/modules/axes-softkeys.vue index 7a32537d..ed52d1e9 100644 --- a/Step/wwwroot/src/modules/axes-softkeys.vue +++ b/Step/wwwroot/src/modules/axes-softkeys.vue @@ -31,6 +31,9 @@ export default { }, selectedAxisId: function() { return this.$store.state.process.selectedAxis; + }, + isDisabled(){ + return this.checkSecurityDisabled('axesSoftkeys'); } }, methods: { @@ -44,10 +47,9 @@ export default { }, setAxes(id) { Hub.Current.selectAxis(id); - }, + } }, props:{ - isDisabled: { default: true, type: Boolean } }, data: function() { return { From 68348c96044a2fbf3635416bb5afaa792d899a7a Mon Sep 17 00:00:00 2001 From: Nicola Carminati Date: Wed, 7 Nov 2018 17:05:44 +0100 Subject: [PATCH 3/3] Fix Last commit --- Step/wwwroot/src/modules/under-the-hood/auto-menu.vue | 1 + Step/wwwroot/src/modules/under-the-hood/jog-menu.vue | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Step/wwwroot/src/modules/under-the-hood/auto-menu.vue b/Step/wwwroot/src/modules/under-the-hood/auto-menu.vue index 80c88e50..361a32d3 100644 --- a/Step/wwwroot/src/modules/under-the-hood/auto-menu.vue +++ b/Step/wwwroot/src/modules/under-the-hood/auto-menu.vue @@ -25,6 +25,7 @@ export default { return false; }, isKeyActive(id) { + if(this.checkSecurityDisabled('ncSoftkeys')) return false; let r = this.$store.getters.getNcSoftKeyStatus(id); if (r) return r.active; return false; diff --git a/Step/wwwroot/src/modules/under-the-hood/jog-menu.vue b/Step/wwwroot/src/modules/under-the-hood/jog-menu.vue index 1be87272..18915c9c 100644 --- a/Step/wwwroot/src/modules/under-the-hood/jog-menu.vue +++ b/Step/wwwroot/src/modules/under-the-hood/jog-menu.vue @@ -1,6 +1,6 @@