Merge branch 'develop' into IobMan
This commit is contained in:
+2
-1
@@ -6,7 +6,8 @@
|
||||
<appSettings>
|
||||
<add key="checkPeriod" value="20" />
|
||||
<add key="chekMult" value="25"/>
|
||||
<add key="watchDogMult" value="1000"/>
|
||||
<add key="watchDogMult" value="500"/>
|
||||
<add key="autoStartProc" value="true"/>
|
||||
<add key="closeOnChildUpdate" value="true"/>
|
||||
<add key="targetExe" value="C:\Steamware\IOB-WIN\IOB-WIN.exe" />
|
||||
<add key="BaseArg" value="MODE=MAN IOB=" />
|
||||
|
||||
Generated
+108
-91
@@ -36,18 +36,19 @@
|
||||
this.tsProgBar = new System.Windows.Forms.ToolStripProgressBar();
|
||||
this.tsslNumProc = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
this.panel1 = new System.Windows.Forms.Panel();
|
||||
this.btnMaximixeAll = new System.Windows.Forms.Button();
|
||||
this.btnMinimizeAll = new System.Windows.Forms.Button();
|
||||
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
|
||||
this.processManagerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.updateIOBMANToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.updateIOBWINToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnMaximixeAll = new System.Windows.Forms.Button();
|
||||
this.btnMinimizeAll = new System.Windows.Forms.Button();
|
||||
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
|
||||
this.panel2 = new System.Windows.Forms.Panel();
|
||||
this.dgvManagedItems = new System.Windows.Forms.DataGridView();
|
||||
this.btnCloseAll = new System.Windows.Forms.Button();
|
||||
this.btnRestartAll = new System.Windows.Forms.Button();
|
||||
this.btnOpenAll = new System.Windows.Forms.Button();
|
||||
this.updateIOBWINToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.updateIOBMANToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnRestartAll = new System.Windows.Forms.Button();
|
||||
this.btnCloseAll = new System.Windows.Forms.Button();
|
||||
this.dgvManagedItems = new System.Windows.Forms.DataGridView();
|
||||
this.chkAutoRestart = new System.Windows.Forms.CheckBox();
|
||||
this.statusStrip1.SuspendLayout();
|
||||
this.panel1.SuspendLayout();
|
||||
this.menuStrip1.SuspendLayout();
|
||||
@@ -62,7 +63,7 @@
|
||||
this.btnClose.BackColor = System.Drawing.SystemColors.WindowText;
|
||||
this.btnClose.ForeColor = System.Drawing.Color.Yellow;
|
||||
this.btnClose.Location = new System.Drawing.Point(11, 138);
|
||||
this.btnClose.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.btnClose.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnClose.Name = "btnClose";
|
||||
this.btnClose.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnClose.TabIndex = 70;
|
||||
@@ -104,37 +105,11 @@
|
||||
this.panel1.Controls.Add(this.menuStrip1);
|
||||
this.panel1.Dock = System.Windows.Forms.DockStyle.Top;
|
||||
this.panel1.Location = new System.Drawing.Point(0, 0);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.panel1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel1.Name = "panel1";
|
||||
this.panel1.Size = new System.Drawing.Size(689, 31);
|
||||
this.panel1.TabIndex = 83;
|
||||
//
|
||||
// btnMaximixeAll
|
||||
//
|
||||
this.btnMaximixeAll.BackColor = System.Drawing.SystemColors.Highlight;
|
||||
this.btnMaximixeAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnMaximixeAll.Location = new System.Drawing.Point(11, 57);
|
||||
this.btnMaximixeAll.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.btnMaximixeAll.Name = "btnMaximixeAll";
|
||||
this.btnMaximixeAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnMaximixeAll.TabIndex = 81;
|
||||
this.btnMaximixeAll.Text = "Show ALL";
|
||||
this.btnMaximixeAll.UseVisualStyleBackColor = false;
|
||||
this.btnMaximixeAll.Click += new System.EventHandler(this.btnMaximixeAll_Click);
|
||||
//
|
||||
// btnMinimizeAll
|
||||
//
|
||||
this.btnMinimizeAll.BackColor = System.Drawing.SystemColors.Highlight;
|
||||
this.btnMinimizeAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnMinimizeAll.Location = new System.Drawing.Point(11, 87);
|
||||
this.btnMinimizeAll.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.btnMinimizeAll.Name = "btnMinimizeAll";
|
||||
this.btnMinimizeAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnMinimizeAll.TabIndex = 80;
|
||||
this.btnMinimizeAll.Text = "Hide ALL";
|
||||
this.btnMinimizeAll.UseVisualStyleBackColor = false;
|
||||
this.btnMinimizeAll.Click += new System.EventHandler(this.btnMinimizeAll_Click);
|
||||
//
|
||||
// menuStrip1
|
||||
//
|
||||
this.menuStrip1.ImageScalingSize = new System.Drawing.Size(20, 20);
|
||||
@@ -156,6 +131,46 @@
|
||||
this.processManagerToolStripMenuItem.Size = new System.Drawing.Size(57, 20);
|
||||
this.processManagerToolStripMenuItem.Text = "&Update";
|
||||
//
|
||||
// updateIOBMANToolStripMenuItem
|
||||
//
|
||||
this.updateIOBMANToolStripMenuItem.Name = "updateIOBMANToolStripMenuItem";
|
||||
this.updateIOBMANToolStripMenuItem.Size = new System.Drawing.Size(167, 22);
|
||||
this.updateIOBMANToolStripMenuItem.Text = "Update IOB-&MAN";
|
||||
this.updateIOBMANToolStripMenuItem.Click += new System.EventHandler(this.updateIOBMANToolStripMenuItem_Click);
|
||||
//
|
||||
// updateIOBWINToolStripMenuItem
|
||||
//
|
||||
this.updateIOBWINToolStripMenuItem.Name = "updateIOBWINToolStripMenuItem";
|
||||
this.updateIOBWINToolStripMenuItem.Size = new System.Drawing.Size(167, 22);
|
||||
this.updateIOBWINToolStripMenuItem.Text = "Update IOB-&WIN";
|
||||
this.updateIOBWINToolStripMenuItem.Click += new System.EventHandler(this.updateIOBWINToolStripMenuItem_Click);
|
||||
//
|
||||
// btnMaximixeAll
|
||||
//
|
||||
this.btnMaximixeAll.BackColor = System.Drawing.SystemColors.Highlight;
|
||||
this.btnMaximixeAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnMaximixeAll.Location = new System.Drawing.Point(11, 57);
|
||||
this.btnMaximixeAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnMaximixeAll.Name = "btnMaximixeAll";
|
||||
this.btnMaximixeAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnMaximixeAll.TabIndex = 81;
|
||||
this.btnMaximixeAll.Text = "Show ALL";
|
||||
this.btnMaximixeAll.UseVisualStyleBackColor = false;
|
||||
this.btnMaximixeAll.Click += new System.EventHandler(this.btnMaximixeAll_Click);
|
||||
//
|
||||
// btnMinimizeAll
|
||||
//
|
||||
this.btnMinimizeAll.BackColor = System.Drawing.SystemColors.Highlight;
|
||||
this.btnMinimizeAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnMinimizeAll.Location = new System.Drawing.Point(11, 87);
|
||||
this.btnMinimizeAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnMinimizeAll.Name = "btnMinimizeAll";
|
||||
this.btnMinimizeAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnMinimizeAll.TabIndex = 80;
|
||||
this.btnMinimizeAll.Text = "Hide ALL";
|
||||
this.btnMinimizeAll.UseVisualStyleBackColor = false;
|
||||
this.btnMinimizeAll.Click += new System.EventHandler(this.btnMinimizeAll_Click);
|
||||
//
|
||||
// tableLayoutPanel1
|
||||
//
|
||||
this.tableLayoutPanel1.ColumnCount = 2;
|
||||
@@ -165,7 +180,7 @@
|
||||
this.tableLayoutPanel1.Controls.Add(this.dgvManagedItems, 0, 0);
|
||||
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 31);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
|
||||
this.tableLayoutPanel1.RowCount = 1;
|
||||
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
|
||||
@@ -175,6 +190,7 @@
|
||||
// panel2
|
||||
//
|
||||
this.panel2.BackColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.panel2.Controls.Add(this.chkAutoRestart);
|
||||
this.panel2.Controls.Add(this.btnOpenAll);
|
||||
this.panel2.Controls.Add(this.btnRestartAll);
|
||||
this.panel2.Controls.Add(this.btnCloseAll);
|
||||
@@ -183,11 +199,51 @@
|
||||
this.panel2.Controls.Add(this.btnMaximixeAll);
|
||||
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.panel2.Location = new System.Drawing.Point(571, 2);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.panel2.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.panel2.Name = "panel2";
|
||||
this.panel2.Size = new System.Drawing.Size(116, 341);
|
||||
this.panel2.TabIndex = 85;
|
||||
//
|
||||
// btnOpenAll
|
||||
//
|
||||
this.btnOpenAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOpenAll.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
this.btnOpenAll.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
|
||||
this.btnOpenAll.Location = new System.Drawing.Point(11, 12);
|
||||
this.btnOpenAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnOpenAll.Name = "btnOpenAll";
|
||||
this.btnOpenAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnOpenAll.TabIndex = 84;
|
||||
this.btnOpenAll.Text = "Open ALL";
|
||||
this.btnOpenAll.UseVisualStyleBackColor = false;
|
||||
this.btnOpenAll.Click += new System.EventHandler(this.btnOpenAll_Click);
|
||||
//
|
||||
// btnRestartAll
|
||||
//
|
||||
this.btnRestartAll.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.btnRestartAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnRestartAll.Location = new System.Drawing.Point(11, 224);
|
||||
this.btnRestartAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnRestartAll.Name = "btnRestartAll";
|
||||
this.btnRestartAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnRestartAll.TabIndex = 83;
|
||||
this.btnRestartAll.Text = "Restart ALL";
|
||||
this.btnRestartAll.UseVisualStyleBackColor = false;
|
||||
this.btnRestartAll.Click += new System.EventHandler(this.btnRestartAll_Click);
|
||||
//
|
||||
// btnCloseAll
|
||||
//
|
||||
this.btnCloseAll.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.btnCloseAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnCloseAll.Location = new System.Drawing.Point(11, 194);
|
||||
this.btnCloseAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnCloseAll.Name = "btnCloseAll";
|
||||
this.btnCloseAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnCloseAll.TabIndex = 82;
|
||||
this.btnCloseAll.Text = "Close ALL";
|
||||
this.btnCloseAll.UseVisualStyleBackColor = false;
|
||||
this.btnCloseAll.Click += new System.EventHandler(this.btnCloseAll_Click);
|
||||
//
|
||||
// dgvManagedItems
|
||||
//
|
||||
this.dgvManagedItems.AllowUserToAddRows = false;
|
||||
@@ -204,59 +260,18 @@
|
||||
this.dgvManagedItems.TabIndex = 76;
|
||||
this.dgvManagedItems.CellDoubleClick += new System.Windows.Forms.DataGridViewCellEventHandler(this.dgvManagedItems_CellDoubleClick);
|
||||
//
|
||||
// btnCloseAll
|
||||
// chkAutoRestart
|
||||
//
|
||||
this.btnCloseAll.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.btnCloseAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnCloseAll.Location = new System.Drawing.Point(11, 194);
|
||||
this.btnCloseAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnCloseAll.Name = "btnCloseAll";
|
||||
this.btnCloseAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnCloseAll.TabIndex = 82;
|
||||
this.btnCloseAll.Text = "Close ALL";
|
||||
this.btnCloseAll.UseVisualStyleBackColor = false;
|
||||
this.btnCloseAll.Click += new System.EventHandler(this.btnCloseAll_Click);
|
||||
//
|
||||
// btnRestartAll
|
||||
//
|
||||
this.btnRestartAll.BackColor = System.Drawing.SystemColors.ControlDarkDark;
|
||||
this.btnRestartAll.ForeColor = System.Drawing.SystemColors.ControlLightLight;
|
||||
this.btnRestartAll.Location = new System.Drawing.Point(11, 224);
|
||||
this.btnRestartAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnRestartAll.Name = "btnRestartAll";
|
||||
this.btnRestartAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnRestartAll.TabIndex = 83;
|
||||
this.btnRestartAll.Text = "Restart ALL";
|
||||
this.btnRestartAll.UseVisualStyleBackColor = false;
|
||||
this.btnRestartAll.Click += new System.EventHandler(this.btnRestartAll_Click);
|
||||
//
|
||||
// btnOpenAll
|
||||
//
|
||||
this.btnOpenAll.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOpenAll.BackColor = System.Drawing.SystemColors.ButtonFace;
|
||||
this.btnOpenAll.ForeColor = System.Drawing.SystemColors.ActiveCaptionText;
|
||||
this.btnOpenAll.Location = new System.Drawing.Point(11, 12);
|
||||
this.btnOpenAll.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.btnOpenAll.Name = "btnOpenAll";
|
||||
this.btnOpenAll.Size = new System.Drawing.Size(96, 26);
|
||||
this.btnOpenAll.TabIndex = 84;
|
||||
this.btnOpenAll.Text = "Open ALL";
|
||||
this.btnOpenAll.UseVisualStyleBackColor = false;
|
||||
this.btnOpenAll.Click += new System.EventHandler(this.btnOpenAll_Click);
|
||||
//
|
||||
// updateIOBWINToolStripMenuItem
|
||||
//
|
||||
this.updateIOBWINToolStripMenuItem.Name = "updateIOBWINToolStripMenuItem";
|
||||
this.updateIOBWINToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.updateIOBWINToolStripMenuItem.Text = "Update IOB-&WIN";
|
||||
this.updateIOBWINToolStripMenuItem.Click += new System.EventHandler(this.updateIOBWINToolStripMenuItem_Click);
|
||||
//
|
||||
// updateIOBMANToolStripMenuItem
|
||||
//
|
||||
this.updateIOBMANToolStripMenuItem.Name = "updateIOBMANToolStripMenuItem";
|
||||
this.updateIOBMANToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
|
||||
this.updateIOBMANToolStripMenuItem.Text = "Update IOB-&MAN";
|
||||
this.updateIOBMANToolStripMenuItem.Click += new System.EventHandler(this.updateIOBMANToolStripMenuItem_Click);
|
||||
this.chkAutoRestart.AutoSize = true;
|
||||
this.chkAutoRestart.Checked = true;
|
||||
this.chkAutoRestart.CheckState = System.Windows.Forms.CheckState.Checked;
|
||||
this.chkAutoRestart.Location = new System.Drawing.Point(11, 283);
|
||||
this.chkAutoRestart.Name = "chkAutoRestart";
|
||||
this.chkAutoRestart.Size = new System.Drawing.Size(85, 17);
|
||||
this.chkAutoRestart.TabIndex = 85;
|
||||
this.chkAutoRestart.Text = "Auto Restart";
|
||||
this.chkAutoRestart.UseVisualStyleBackColor = true;
|
||||
this.chkAutoRestart.CheckedChanged += new System.EventHandler(this.chkAutoRestart_CheckedChanged);
|
||||
//
|
||||
// IOBManPanel
|
||||
//
|
||||
@@ -270,7 +285,7 @@
|
||||
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
|
||||
this.IsMdiContainer = true;
|
||||
this.MainMenuStrip = this.menuStrip1;
|
||||
this.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
|
||||
this.Margin = new System.Windows.Forms.Padding(2);
|
||||
this.Name = "IOBManPanel";
|
||||
this.Text = "IOB MANAGER";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IOBManPanel_FormClosing);
|
||||
@@ -282,6 +297,7 @@
|
||||
this.menuStrip1.PerformLayout();
|
||||
this.tableLayoutPanel1.ResumeLayout(false);
|
||||
this.panel2.ResumeLayout(false);
|
||||
this.panel2.PerformLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.dgvManagedItems)).EndInit();
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
@@ -307,6 +323,7 @@
|
||||
private System.Windows.Forms.Button btnOpenAll;
|
||||
private System.Windows.Forms.ToolStripMenuItem updateIOBMANToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem updateIOBWINToolStripMenuItem;
|
||||
}
|
||||
private System.Windows.Forms.CheckBox chkAutoRestart;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+98
-59
@@ -75,6 +75,11 @@ namespace IOB_MAN
|
||||
loadConfig();
|
||||
MainTimer.Start();
|
||||
utils.lgInfo("Timer started");
|
||||
if (utils.CRB("autoStartProc"))
|
||||
{
|
||||
apriChild();
|
||||
utils.lgInfo("Start processi effettuato");
|
||||
}
|
||||
}
|
||||
|
||||
private void loadConfig()
|
||||
@@ -121,6 +126,7 @@ namespace IOB_MAN
|
||||
{
|
||||
// aggiorno labels
|
||||
tsslNumProc.Text = $"Configurati {ArgsList.Count} processi | Avviati: {numProcAvviati} | Attivi: {numProcRunning}";
|
||||
bool hlRestart = false;
|
||||
// colore da num proc...
|
||||
if (numProcRunning == ArgsList.Count)
|
||||
{
|
||||
@@ -129,10 +135,23 @@ namespace IOB_MAN
|
||||
else if (numProcAvviati < ArgsList.Count)
|
||||
{
|
||||
tsslNumProc.ForeColor = System.Drawing.Color.DarkRed;
|
||||
hlRestart = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
tsslNumProc.ForeColor = System.Drawing.Color.OrangeRed;
|
||||
hlRestart = true;
|
||||
}
|
||||
// fix autorestart...
|
||||
if(hlRestart)
|
||||
{
|
||||
chkAutoRestart.ForeColor = System.Drawing.Color.Red;
|
||||
chkAutoRestart.Text = "Auto Restart!!!";
|
||||
}
|
||||
else
|
||||
{
|
||||
chkAutoRestart.ForeColor = DefaultForeColor;
|
||||
chkAutoRestart.Text = "Auto Restart";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -141,36 +160,43 @@ namespace IOB_MAN
|
||||
/// </summary>
|
||||
private void apriChild()
|
||||
{
|
||||
//Process childProc = new Process();
|
||||
ProcessStartInfo psi = null;
|
||||
foreach (var item in ArgsList)
|
||||
{
|
||||
// da testare x aprire chiudere risorsa...
|
||||
psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = TargetExe,
|
||||
Arguments = $"{utils.CRS("BaseArg")}{item}",
|
||||
WindowStyle = ProcessWindowStyle.Minimized
|
||||
};
|
||||
|
||||
//childProc.StartInfo = psi;
|
||||
Process p = Process.Start(psi);
|
||||
|
||||
// accodo nuovo IOB...
|
||||
iobAdapt newIob = new iobAdapt();
|
||||
DateTime adesso = DateTime.Now;
|
||||
newIob.CodIOB = item;
|
||||
newIob.startTime = adesso;
|
||||
newIob.pID = p.Id;
|
||||
newIob.isRunning = true;
|
||||
// aggiungo a datasource
|
||||
ElencoIOB.Add(newIob);
|
||||
|
||||
utils.lgInfo($"Avviato child process per {item} | pid: {p.Id}");
|
||||
startChildProc(item);
|
||||
}
|
||||
numProcAvviati = ArgsList.Count;
|
||||
numProcRunning = numProcAvviati;
|
||||
}
|
||||
/// <summary>
|
||||
/// Avvio di un child process da parametro ARG
|
||||
/// </summary>
|
||||
/// <param name="procArg"></param>
|
||||
private void startChildProc(string procArg)
|
||||
{
|
||||
ProcessStartInfo psi = null;
|
||||
// da testare x aprire chiudere risorsa...
|
||||
psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = TargetExe,
|
||||
Arguments = $"{utils.CRS("BaseArg")}{procArg}",
|
||||
WindowStyle = ProcessWindowStyle.Minimized
|
||||
};
|
||||
|
||||
//childProc.StartInfo = psi;
|
||||
Process p = Process.Start(psi);
|
||||
|
||||
// accodo nuovo IOB...
|
||||
iobAdapt newIob = new iobAdapt();
|
||||
DateTime adesso = DateTime.Now;
|
||||
newIob.CodIOB = procArg;
|
||||
newIob.startTime = adesso;
|
||||
newIob.pID = p.Id;
|
||||
newIob.isRunning = true;
|
||||
// aggiungo a datasource
|
||||
ElencoIOB.Add(newIob);
|
||||
|
||||
utils.lgInfo($"Avviato child process per {procArg} | pid: {p.Id}");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apro un child x fare udpate con parametro che impedisca avvio IOB
|
||||
@@ -272,52 +298,43 @@ namespace IOB_MAN
|
||||
if (watchDogMult < 0)
|
||||
{
|
||||
watchDogMult = utils.CRI("watchDogMult");
|
||||
// verifico se ci siano processi (da ARGS LIST) NON running --> li riavvio!
|
||||
List<iobAdapt> proc2restart = new List<iobAdapt>();
|
||||
foreach (iobAdapt item in ElencoIOB.List)
|
||||
processAutoRestart();
|
||||
// aggiorno datagrid!
|
||||
dgvManagedItems.Invalidate();
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Effettua processing autorestart
|
||||
/// </summary>
|
||||
private void processAutoRestart()
|
||||
{
|
||||
// verifico se ci siano processi (da ARGS LIST) NON running --> li riavvio!
|
||||
List<iobAdapt> proc2restart = new List<iobAdapt>();
|
||||
foreach (iobAdapt item in ElencoIOB.List)
|
||||
{
|
||||
if (!item.isRunning)
|
||||
{
|
||||
if (!item.isRunning)
|
||||
{
|
||||
// segno da eliminare e riavviare
|
||||
proc2restart.Add(item);
|
||||
}
|
||||
// segno da eliminare e riavviare
|
||||
proc2restart.Add(item);
|
||||
}
|
||||
}
|
||||
// SE abilitato autorestart...
|
||||
if (chkAutoRestart.Checked)
|
||||
{
|
||||
// se ho da riavviare... elimino!
|
||||
foreach (var item in proc2restart)
|
||||
{
|
||||
ElencoIOB.Remove(item);
|
||||
utils.lgInfo($"Chiusura processo non running | IOB: {item.CodIOB} | pid: {item.pID}");
|
||||
}
|
||||
// gestisco processi chiusi
|
||||
ProcessStartInfo psi = null;
|
||||
// li faccio ripartire!
|
||||
foreach (var item in proc2restart)
|
||||
{
|
||||
// da testare x aprire chiudere risorsa...
|
||||
psi = new ProcessStartInfo
|
||||
{
|
||||
FileName = TargetExe,
|
||||
Arguments = item.CodIOB,
|
||||
WindowStyle = ProcessWindowStyle.Minimized
|
||||
};
|
||||
|
||||
//childProc.StartInfo = psi;
|
||||
Process p = Process.Start(psi);
|
||||
// accodo nuovo IOB...
|
||||
iobAdapt newIob = new iobAdapt();
|
||||
DateTime adesso = DateTime.Now;
|
||||
newIob.CodIOB = item.CodIOB;
|
||||
newIob.startTime = adesso;
|
||||
newIob.pID = p.Id;
|
||||
newIob.isRunning = true;
|
||||
// aggiungo a datasource
|
||||
ElencoIOB.Add(newIob);
|
||||
utils.lgInfo($"Riavvio processo | IOB: {newIob.CodIOB} | pid: {newIob.pID}");
|
||||
startChildProc(item.CodIOB);
|
||||
}
|
||||
// aggiorno datagrid!
|
||||
dgvManagedItems.Invalidate();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Controllo periodico dei processi attivi
|
||||
/// </summary>
|
||||
@@ -417,9 +434,25 @@ namespace IOB_MAN
|
||||
{
|
||||
foreach (var item in stillRunningProc)
|
||||
{
|
||||
Process p = Process.GetProcessById(item.Id);
|
||||
p.CloseMainWindow();
|
||||
p.Kill();
|
||||
try
|
||||
{
|
||||
Process p = Process.GetProcessById(item.Id);
|
||||
p.CloseMainWindow();
|
||||
p.WaitForExit(250);
|
||||
if (!p.HasExited)
|
||||
{
|
||||
utils.lgError($"Process not exited, now calling p.Close()");
|
||||
p.Close();
|
||||
}
|
||||
p.WaitForExit(250);
|
||||
if (!p.HasExited)
|
||||
{
|
||||
utils.lgError($"Process not exited, now calling p.Kill()");
|
||||
p.Kill();
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
}
|
||||
}
|
||||
// resetto elenco!
|
||||
@@ -615,6 +648,12 @@ namespace IOB_MAN
|
||||
// apre solo 1 con conf "fake" x condurre update...
|
||||
apriOneUpdate();
|
||||
}
|
||||
|
||||
private void chkAutoRestart_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
// fa subito controllo riavvio...
|
||||
processAutoRestart();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user