diff --git a/IOB-MAN/App.config b/IOB-MAN/App.config index 2a0b1b90..b2e84702 100644 --- a/IOB-MAN/App.config +++ b/IOB-MAN/App.config @@ -7,8 +7,9 @@ - - - + + + + \ No newline at end of file diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index fc73d4c8..a116dd48 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -149,7 +149,7 @@ namespace IOB_MAN psi = new ProcessStartInfo { FileName = TargetExe, - Arguments = item, + Arguments = $"{utils.CRS("BaseArg")}{item}", WindowStyle = ProcessWindowStyle.Minimized }; @@ -183,15 +183,19 @@ namespace IOB_MAN psi = new ProcessStartInfo { FileName = TargetExe, - Arguments = "NONE", + Arguments = "MODE=UPD IOB=NONE", WindowStyle = ProcessWindowStyle.Normal }; + // avvio processo con using... using (Process p = Process.Start(psi)) { p.WaitForExit(); - // ora chiudo current... - this.Close(); + // ora chiudo current... SE configurato + if (utils.CRB("closeOnChildUpdate")) + { + this.Close(); + } } } /// @@ -373,13 +377,6 @@ namespace IOB_MAN item.isRunning = true; } } -#if false - // ora procdedo alla cancellazione... - foreach (var item in item2rem) - { - ElencoIOB.Remove(item); - } -#endif // aggiorno datagrid! dgvManagedItems.Invalidate(); updateStatus(); @@ -414,7 +411,7 @@ namespace IOB_MAN } } // per sicurezza CERCO i processi x nome... - string nomeProc = Path.GetFileName(TargetExe).Replace(".exe",""); + string nomeProc = Path.GetFileName(TargetExe).Replace(".exe", ""); var stillRunningProc = Process.GetProcessesByName(nomeProc); if (stillRunningProc != null) { @@ -444,7 +441,7 @@ namespace IOB_MAN { bool selected = (dgvManagedItems.SelectedRows.Count > 0); btnClose.Enabled = selected; - } + } private void dgvManagedItems_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { @@ -574,7 +571,7 @@ namespace IOB_MAN // apre solo 1 con conf "fake" x condurre update... apriOneUpdate(); } - + private void btnCloseAll_Click(object sender, EventArgs e) { // chiude tutto @@ -617,7 +614,6 @@ namespace IOB_MAN updateStatus(); // apre solo 1 con conf "fake" x condurre update... apriOneUpdate(); - } } diff --git a/IOB-WIN/AdapterForm.cs b/IOB-WIN/AdapterForm.cs index dcdc1bd1..3b9cb91a 100644 --- a/IOB-WIN/AdapterForm.cs +++ b/IOB-WIN/AdapterForm.cs @@ -1005,8 +1005,8 @@ namespace IOB_WIN start.Enabled = false; break; } - lblCNC.Text = string.Format("CNC: {0} [{1}:{2}]", IOBConf.tipoIob, IOBConf.cncIpAddr, IOBConf.cncPort); - lblSrvUrl.Text = string.Format("SRV: {0} | URL: {1}{2}", IOBConf.serverData.MPIP, IOBConf.serverData.MPURL, IOBConf.serverData.CMDBASE); + lblCNC.Text = $"CNC: {IOBConf.tipoIob} [{IOBConf.cncIpAddr}:{IOBConf.cncPort}]"; + lblSrvUrl.Text = $"SRV: {IOBConf.serverData.MPIP} | URL: {IOBConf.serverData.MPURL}{IOBConf.serverData.CMDBASE}"; // aggancio evento refresh iobObj.eh_refreshed += IobObj_eh_refreshed; diff --git a/IOB-WIN/Enums.cs b/IOB-WIN/Enums.cs index bff4897d..a3f521d2 100644 --- a/IOB-WIN/Enums.cs +++ b/IOB-WIN/Enums.cs @@ -5,7 +5,19 @@ using System.Text; namespace IOB_WIN { - public class Enums + public enum StartMode { + /// + /// modalità standard (standalone, multi IOB) + /// + STD = 0, + /// + /// Modalità managed (da IOB-MAN) + /// + MAN = 1, + /// + /// Modalità update (per aggiornare IOB-WIN) senza IOB + /// + UPD = 2 } } diff --git a/IOB-WIN/MainForm.cs b/IOB-WIN/MainForm.cs index 189bb4e8..d55e118e 100644 --- a/IOB-WIN/MainForm.cs +++ b/IOB-WIN/MainForm.cs @@ -23,10 +23,18 @@ namespace IOB_WIN #region variabili globali, utils ed helpers /// - /// PArametri (opzionali) di avvio + /// Parametri (opzionali) di avvio /// protected string[] myArgs; /// + /// Dizionario dei parametri di avvio (da elenco args...) + /// + protected Dictionary startParams = new Dictionary(); + /// + /// Modalità di avvio + /// + protected StartMode ModoAvvio = StartMode.STD; + /// /// Ramo applicazione (x update) /// protected string branchName = "master"; @@ -299,8 +307,8 @@ namespace IOB_WIN /// public MainForm(string[] args) { - // salgo args di avvio - myArgs = args; + // salvo aprametri avvio... + saveArgs(args); // continuo iNIT!!! InitializeComponent(); myInit(); @@ -320,6 +328,37 @@ namespace IOB_WIN } } } + /// + /// effettua salvataggio argomenti + /// + /// + protected void saveArgs(string[] args) + { + if (args != null) + { + // salvo args di avvio (sono parametri tipo param1=val1 param2=test1,test2,test3 + myArgs = args; + if (myArgs.Length > 0) + { + // salvo dictionary! + foreach (var item in myArgs) + { + var kvp = item.Split('='); + startParams.Add(kvp[0], kvp[1]); + } + } + // verifico gli args... + if (startParams.ContainsKey("MODE")) + { + try + { + ModoAvvio = (StartMode)Enum.Parse(typeof(StartMode), startParams["MODE"]); + } + catch + { } + } + } + } protected void myInit() { @@ -335,7 +374,7 @@ namespace IOB_WIN notifyIcon1.Icon = Icon.ExtractAssociatedIcon(utils.defIconFilePath); // fix versione! - lblApp.Text = string.Format("{0}", ConfigurationManager.AppSettings.Get("appName")); + lblApp.Text = $"{ConfigurationManager.AppSettings.Get("appName")} ({ModoAvvio})"; lblVers.Text = string.Format(" v.{0}", System.Reflection.Assembly.GetExecutingAssembly().GetName().Version); @@ -363,7 +402,6 @@ namespace IOB_WIN { try { - loadIniFile(utils.mainConfFilePath); lgInfo("INI LOADED"); // avvio child come richiesto! @@ -470,13 +508,37 @@ namespace IOB_WIN CMDIOB2CALL = fIni.ReadString("SERVER", "CMDIOB2CALL", "/IOB/getIob2call?GWIP="); MAXCNC = fIni.ReadInteger("IOB", "MAXCNC", 1); string STARTLIST = fIni.ReadString("IOB", "STARTLIST", ""); - if (STARTLIST != "") + // Gestione IOB da avviare + IOB2START = new List(); + // SE se sono in modo UPD --> nessuno + if (ModoAvvio == StartMode.UPD) { - IOB2START = new List(); - string[] elenco = STARTLIST.Split(','); - foreach (var item in elenco) + IOB2START.Add("NONE"); + } + else + { + string[] elenco = null; + // se modalità MAN CERCO se sostituire STARTLIST + if (ModoAvvio == StartMode.MAN) { - IOB2START.Add(item); + if (!string.IsNullOrEmpty(startParams["IOB"])) + { + STARTLIST = startParams["IOB"]; + } + } + // se ho qualcosa... + if (!string.IsNullOrEmpty(STARTLIST)) + { + elenco = STARTLIST.Split(','); + // inserisco da elenco! + foreach (var item in elenco) + { + IOB2START.Add(item); + } + } + else + { + IOB2START.Add("NONE"); } } } @@ -870,11 +932,19 @@ namespace IOB_WIN { WindowState = FormWindowState.Minimized; } - // controllo cosa devo mostrare... - if (WindowState == FormWindowState.Minimized) + // SOLO SE se sono in modo STD + if (ModoAvvio == StartMode.STD) { - notifyIcon1.Visible = false; - sendToTray(); + // controllo cosa devo mostrare... + if (WindowState == FormWindowState.Minimized) + { + notifyIcon1.Visible = false; + sendToTray(); + } + else + { + notifyIcon1.Visible = false; + } } else { @@ -987,11 +1057,15 @@ namespace IOB_WIN /// private void MainForm_Shown(object sender, EventArgs e) { - // avvio minimizzato se richiesto - if (utils.CRB("startMinimized")) + // SOLO SE se sono in modo STD + if (ModoAvvio == StartMode.STD) { - // controllo e mando a tray... - sendToTray(); + // avvio minimizzato se richiesto + if (utils.CRB("startMinimized")) + { + // controllo e mando a tray... + sendToTray(); + } } displayTaskAndLog("Main Form SHOWN"); } diff --git a/Jenkinsfile b/Jenkinsfile index f8ae983d..e5977cbf 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -16,7 +16,7 @@ pipeline { /* calcolo numero versione... diverso x branch MASTER/DEVELOP */ script { - withEnv(['NEXT_BUILD_NUMBER=615']) { + withEnv(['NEXT_BUILD_NUMBER=617']) { // env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true) env.versionNumber = VersionNumber(versionNumberString : '3.0.${BUILD_DATE_FORMATTED, "yyMM"}.${BUILDS_ALL_TIME}', projectStartDate : '2006-01-01', skipFailedBuilds: true, overrideBuildsAllTime: '${NEXT_BUILD_NUMBER}') env.APP_NAME = 'MAPO-IOB-WIN'