From 706c4763c01af4c241adf52b157e420b1de570b7 Mon Sep 17 00:00:00 2001 From: "CMS3762\\carminatini" Date: Mon, 4 Dec 2017 17:03:31 +0100 Subject: [PATCH] Fixed Step.Client & Step.UI Bugs --- Step.Client/Program.cs | 3 ++- Step.Client/Properties/AssemblyInfo.cs | 4 +-- Step.Client/Step.Client.csproj | 2 +- Step.Client/View/LoadingForm.cs | 5 +++- Step.Client/View/MainForm.cs | 13 +++++++--- Step.UI/ServerControlWindow.cs | 35 ++++++++++++++++++++------ Step.UI/Step.UI.csproj | 10 ++++++++ 7 files changed, 57 insertions(+), 15 deletions(-) diff --git a/Step.Client/Program.cs b/Step.Client/Program.cs index 6d5feedd..4975e531 100644 --- a/Step.Client/Program.cs +++ b/Step.Client/Program.cs @@ -14,6 +14,7 @@ namespace CMS_Client { public static class Program { + //Set the Mutef of GUID static Mutex CmsStepMutex = new Mutex(true, "{66fa29db-925a-402b-a4c7-d3d780fb1bc3}"); @@ -22,7 +23,7 @@ namespace CMS_Client { //Check the first argument -> Url - if(args.Count() > 0) + if (args.Count() > 0) { Uri UrlResArg; if(Uri.TryCreate(args[0], UriKind.Absolute, out UrlResArg) && (UrlResArg.Scheme == Uri.UriSchemeHttp || UrlResArg.Scheme == Uri.UriSchemeHttps)) diff --git a/Step.Client/Properties/AssemblyInfo.cs b/Step.Client/Properties/AssemblyInfo.cs index 799c17b7..7e506e7a 100644 --- a/Step.Client/Properties/AssemblyInfo.cs +++ b/Step.Client/Properties/AssemblyInfo.cs @@ -5,11 +5,11 @@ using System.Runtime.InteropServices; // Le informazioni generali relative a un assembly sono controllate dal seguente // set di attributi. Modificare i valori di questi attributi per modificare le informazioni // associate a un assembly. -[assembly: AssemblyTitle("CMS-STEP Client")] +[assembly: AssemblyTitle("CMS Step - Client")] [assembly: AssemblyDescription("STEP Client For CMS Machines")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("CMS Spa")] -[assembly: AssemblyProduct("CMS-STEP Client")] +[assembly: AssemblyProduct("CMS Step - Client")] [assembly: AssemblyCopyright("Copyright © 2017")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/Step.Client/Step.Client.csproj b/Step.Client/Step.Client.csproj index b8ab4f54..7e310304 100644 --- a/Step.Client/Step.Client.csproj +++ b/Step.Client/Step.Client.csproj @@ -77,7 +77,7 @@ true - bin\x64\Debug\ + ..\Step\bin\Client\x64\ DEBUG;TRACE full x64 diff --git a/Step.Client/View/LoadingForm.cs b/Step.Client/View/LoadingForm.cs index 4ebf888b..126a46c7 100644 --- a/Step.Client/View/LoadingForm.cs +++ b/Step.Client/View/LoadingForm.cs @@ -45,7 +45,10 @@ namespace CMS_Client.View ConnTask = Task.Run(() => BagroundWorker()); //Setup product label - VersionLBL.Text = Application.ProductName + " V" + Application.ProductVersion; + if(Environment.Is64BitProcess) + VersionLBL.Text = Application.ProductName + " V" + Application.ProductVersion + " - 64 Bit"; + else + VersionLBL.Text = Application.ProductName + " V" + Application.ProductVersion + " - 32 Bit"; } diff --git a/Step.Client/View/MainForm.cs b/Step.Client/View/MainForm.cs index 15508ad3..7fc1be05 100644 --- a/Step.Client/View/MainForm.cs +++ b/Step.Client/View/MainForm.cs @@ -250,8 +250,8 @@ namespace CMS_Client.View if (CMSConfiguration.HMINcPresent) NcWindow.StartNcFollowing(MainHandle, NcHandle, NcFrm.Width, NcFrm.Height); - //If is an Error Show the Error page TODO-> Erorr Page in HTML, nel browser! - if (LoadingError.Error) + //If is an Error Show the Error page + if (LoadingError.Error && !LoadingError.ErrorInfo.Contains("ERR_ABORTED")) MessageBox.Show("Error While Loading the Page: " + LoadingError.ErrorInfo + "\nPress:\n - F5: reload the Page\n - F1: Back to last Page"); //Set focus on the page @@ -327,7 +327,14 @@ namespace CMS_Client.View //Set Window Title private void SetWindowTitle(String Title) { - Title = Application.ProductName + " | " + Title; + + + //Setup product label + if (Environment.Is64BitProcess) + Title = Application.ProductName + " x64 | " + Title; + else + Title = Application.ProductName + " x86 | " + Title; + //Invoke method if is needed or call the method in STD mode if (this.InvokeRequired) diff --git a/Step.UI/ServerControlWindow.cs b/Step.UI/ServerControlWindow.cs index 42ae3b63..32b4356e 100644 --- a/Step.UI/ServerControlWindow.cs +++ b/Step.UI/ServerControlWindow.cs @@ -3,22 +3,22 @@ using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Diagnostics; -using System.Drawing; -using System.Linq; -using System.Text; +using System.IO; using System.Threading; -using System.Threading.Tasks; using System.Windows.Forms; -using TeamDev.SDK; using TeamDev.SDK.MVVM; +using static Step.Config.StartupConfig; namespace Step.UI { public partial class ServerControlWindow : Form { + String HomePageUI; + public ServerControlWindow() { InitializeComponent(); + HomePageUI = "http://localhost:" + serverConfig.ServerPort.ToString() + "index.html"; } private static ServerControlWindow ctrlwindow = null; @@ -64,8 +64,9 @@ namespace Step.UI } private void OpenUiButton_Click(object sender, EventArgs e) - { - Process.Start(Environment.CurrentDirectory + @"\Client\x86\CMS_Client.exe", "http://localhost:9000/index.html"); + { + //Open CMS Client + StartCMSClient(); } private void StopServerButton_Click(object sender, EventArgs e) @@ -85,5 +86,25 @@ namespace Step.UI { MessageServices.Current.Publish("StopServer"); } + + + private void StartCMSClient() + { + //Setup the Path Variable + String CMSClientPath = ""; + + //Check if the system is 64/32 bit + if (Environment.Is64BitOperatingSystem && File.Exists(Environment.CurrentDirectory + @"\Client\x64\CMS_Client.exe")) + CMSClientPath = Environment.CurrentDirectory + @"\Client\x64\CMS_Client.exe"; + + else if (File.Exists(Environment.CurrentDirectory + @"\Client\x86\CMS_Client.exe")) + CMSClientPath = Environment.CurrentDirectory + @"\Client\x86\CMS_Client.exe"; + + if(!String.IsNullOrEmpty(CMSClientPath)) + Process.Start(CMSClientPath, HomePageUI); + else + MessageBox.Show("CMS_Client.Exe not found"); + + } } } diff --git a/Step.UI/Step.UI.csproj b/Step.UI/Step.UI.csproj index 35b81ae9..29e525de 100644 --- a/Step.UI/Step.UI.csproj +++ b/Step.UI/Step.UI.csproj @@ -77,5 +77,15 @@ + + + {3f5c2483-fc87-43ef-92a8-66ff7d0e440f} + Step.Config + + + {631375DD-06D3-49BB-8130-D9DDB34C429D} + Step.Model + + \ No newline at end of file