Added close server when close client if the option "autoOpenCmsClient" in server is TRUE

This commit is contained in:
Nicola Carminati
2019-04-11 11:46:19 +02:00
parent 285fdf3fe2
commit eb98081712
7 changed files with 29 additions and 2 deletions
+1
View File
@@ -16,5 +16,6 @@ namespace Client.Config.SubModels
public Boolean ShowVirtualKeyboard { get; set; }
public Boolean DeveloperMode { get; set; }
public Boolean IsSCM { get; set; }
public Boolean Autorun { get; set; }
}
}
@@ -14,6 +14,7 @@ namespace Client.Config.SubModels
public string NcPort { get; set; }
public string ProdEnabled { get; set; }
public string ProdPath { get; set; }
public string Autorun { get; set; }
public List<Software> ExtSoftwares { get; set; }
}
}
+12
View File
@@ -10,6 +10,7 @@ using System.Drawing;
using System.Linq;
using System.Windows.Forms;
using static Client.Utils.Constants;
using System.Diagnostics;
namespace Active_Client.View
{
@@ -170,6 +171,17 @@ namespace Active_Client.View
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);
+9 -1
View File
@@ -244,7 +244,9 @@ namespace Active_Client.View
Config.VendorHmiConfig.IpAddress = ConfigResponse.NcIp.ToUpper();
Config.VendorHmiConfig.Port = ConfigResponse.NcPort.ToUpper();
string ProdEnabled = ConfigResponse.ProdEnabled.ToUpper();
string ProdPath = ConfigResponse.ProdPath.ToUpper();
string ProdPath = ConfigResponse.ProdPath.ToUpper();
string Autorun = ConfigResponse.Autorun.ToUpper();
//Read the Server Type
if (ncVendorName.Equals("DEMO"))
@@ -267,6 +269,12 @@ namespace Active_Client.View
Config.VendorHmiConfig.Enabled = true;
else
Config.VendorHmiConfig.Enabled = false;
//Autorun
if (Autorun.ToUpper().Equals("TRUE"))
Config.ClientConfig.Autorun = true;
else
Config.ClientConfig.Autorun = false;
//Read if the HMI must be visible
@@ -13,6 +13,7 @@ namespace Step.Model.DTOModels
public ushort NcPort { get; set; }
public bool ProdEnabled { get; set; }
public string ProdPath { get; set; }
public bool Autorun { get; set; }
public List<ExtSoftwareModel> ExtSoftwares { get; set; }
public CultureInfo DefaultLanguage
@@ -44,7 +44,8 @@ namespace Step.Controllers.WebApi
NcPort = NcConfig.NcPort,
ProdEnabled = SoftwareProdConfig.Enabled,
ProdPath = SoftwareProdConfig.Path,
ExtSoftwares = ExtSoftwaresConfig
ExtSoftwares = ExtSoftwaresConfig,
Autorun = ServerStartupConfig.AutoOpenCmsClient
};
return Ok(clientConfiguration);
@@ -40,6 +40,7 @@ Vue.mixin({
if (!store) return false;
let securityFunction = (store.state as any).machineStatus.functions.find(i => i.name == key) as signalr_security.securityFunction;
console.log("Security", securityFunction);
if (!securityFunction) {
console.debug("Security function not found", key);
return false;
@@ -52,6 +53,8 @@ Vue.mixin({
if (!store) return true;
let securityFunction = (store.state as any).machineStatus.functions.find(i => i.name == key) as signalr_security.securityFunction;
console.log("Security", (store.state as any).machineStatus.functions as signalr_security.securityFunction);
if (!securityFunction) {
console.debug("Security function not found", key);
return true;