diff --git a/Client/View/MainForm.cs b/Client/View/MainForm.cs index 97fd56fb..7c09d82b 100644 --- a/Client/View/MainForm.cs +++ b/Client/View/MainForm.cs @@ -162,17 +162,7 @@ namespace Active_Client.View //Close the NC HMI && Stop Following Nc if (Config.VendorHmiConfig.Enabled) NcWindow.CloseNcWindow(false); - - //Close Server - if (Config.ClientConfig.Autorun) - { - Process[] proc = Process.GetProcessesByName("Active"); - foreach (Process p in proc) - { - p.Kill(); - p.WaitForExit(); - } - } + if (Config.ProdSoftwareConfig.Enabled) NcWindow.CloseProdWindow(false); @@ -189,7 +179,7 @@ namespace Active_Client.View } } - //Before closing the Window -> Remove the Browser (Increase the speed of closing window) + private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { diff --git a/Step.UI/ServerControlWindow.Designer.cs b/Step.UI/ServerControlWindow.Designer.cs index bcf48fae..44221774 100644 --- a/Step.UI/ServerControlWindow.Designer.cs +++ b/Step.UI/ServerControlWindow.Designer.cs @@ -90,7 +90,7 @@ namespace Step.UI this.StopServerItem}); this.NotifyIconMenu.Name = "NotifyIconMenu"; this.NotifyIconMenu.RenderMode = System.Windows.Forms.ToolStripRenderMode.Professional; - this.NotifyIconMenu.Size = new System.Drawing.Size(181, 76); + this.NotifyIconMenu.Size = new System.Drawing.Size(175, 54); // // adminMachineToolStripMenuItem // @@ -101,7 +101,7 @@ namespace Step.UI this.resetSpindleHoursToolStripMenuItem, this.resetCountersToolStripMenuItem}); this.adminMachineToolStripMenuItem.Name = "adminMachineToolStripMenuItem"; - this.adminMachineToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.adminMachineToolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.adminMachineToolStripMenuItem.Text = "Service"; // // passwordToolStripMenuItem @@ -146,12 +146,12 @@ namespace Step.UI // toolStripSeparator3 // this.toolStripSeparator3.Name = "toolStripSeparator3"; - this.toolStripSeparator3.Size = new System.Drawing.Size(177, 6); + this.toolStripSeparator3.Size = new System.Drawing.Size(171, 6); // // StopServerItem // this.StopServerItem.Name = "StopServerItem"; - this.StopServerItem.Size = new System.Drawing.Size(180, 22); + this.StopServerItem.Size = new System.Drawing.Size(174, 22); this.StopServerItem.Text = "Close Active Server"; this.StopServerItem.Click += new System.EventHandler(this.StopServerItem_Click); // @@ -352,14 +352,14 @@ namespace Step.UI // closeCMSServerToolStripMenuItem // this.closeCMSServerToolStripMenuItem.Name = "closeCMSServerToolStripMenuItem"; - this.closeCMSServerToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.closeCMSServerToolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.closeCMSServerToolStripMenuItem.Text = "Close Active Server"; this.closeCMSServerToolStripMenuItem.Click += new System.EventHandler(this.closeCMSServerToolStripMenuItem_Click); // // toolStripSeparator2 // this.toolStripSeparator2.Name = "toolStripSeparator2"; - this.toolStripSeparator2.Size = new System.Drawing.Size(177, 6); + this.toolStripSeparator2.Size = new System.Drawing.Size(171, 6); // // serviceToolStripMenuItem // @@ -370,7 +370,7 @@ namespace Step.UI this.resetSpindleHoursToolStripMenuItem1, this.resetCountersToolStripMenuItem1}); this.serviceToolStripMenuItem.Name = "serviceToolStripMenuItem"; - this.serviceToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.serviceToolStripMenuItem.Size = new System.Drawing.Size(174, 22); this.serviceToolStripMenuItem.Text = "Service"; // // passwordToolStripMenuItem1 diff --git a/Step/Controllers/SignalR/NcHub.cs b/Step/Controllers/SignalR/NcHub.cs index 04cb3fa2..b8d2532d 100644 --- a/Step/Controllers/SignalR/NcHub.cs +++ b/Step/Controllers/SignalR/NcHub.cs @@ -234,6 +234,12 @@ namespace Step.Controllers.SignalR if (cmsError.IsError()) throw new HubException(cmsError.localizationKey); } + } + + public void QuitServerApp() + { + if (ServerStartupConfig.AutoOpenCmsClient) + MessageServices.Current.Publish(SEND_STOP_SERVER); } } } \ No newline at end of file diff --git a/Step/wwwroot/src/app.business-logic.ts b/Step/wwwroot/src/app.business-logic.ts index 42f2dafb..b0e21b2b 100644 --- a/Step/wwwroot/src/app.business-logic.ts +++ b/Step/wwwroot/src/app.business-logic.ts @@ -18,6 +18,7 @@ import { DEBUG_CONFIGURATION, USE_RUNTIME_CONFIGURATION } from "./config"; import { ModalHelper } from "./components/modals"; import Vue from "vue"; import { scadaService } from "./services/scadaService"; +import { Hub } from "./services"; declare let cmsClient: any; let HMIvisible = false; @@ -126,6 +127,7 @@ if (typeof cmsClient != "undefined") { Vue.filter('localize')("modal_confirm_close_application", "Sei sicuro di voler chiudere l'applicazione?"), () => { messageService.publishToChannel("close-scada"); + Hub.Current.QuitServerApp(); cmsClient.closeForm(); },null ,'modal'); } diff --git a/Step/wwwroot/src/services/hub.ts b/Step/wwwroot/src/services/hub.ts index 876df765..6b369598 100644 --- a/Step/wwwroot/src/services/hub.ts +++ b/Step/wwwroot/src/services/hub.ts @@ -426,6 +426,10 @@ export class Hub { this._hub.server.selectAxis(id); } + public QuitServerApp() { + this._hub.server.quitServerApp(); + } + public Hello() { this._hub.server.hello(); }