diff --git a/IOB-MAN/IOBManPanel.Designer.cs b/IOB-MAN/IOBManPanel.Designer.cs index c26879b4..6bf5abd1 100644 --- a/IOB-MAN/IOBManPanel.Designer.cs +++ b/IOB-MAN/IOBManPanel.Designer.cs @@ -33,12 +33,13 @@ this.btnClose = new System.Windows.Forms.Button(); this.childList = new System.Windows.Forms.ListBox(); this.MainTimer = new System.Windows.Forms.Timer(this.components); + this.lblNumChild = new System.Windows.Forms.Label(); this.SuspendLayout(); // // btnOpen // this.btnOpen.Location = new System.Drawing.Point(18, 60); - this.btnOpen.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.btnOpen.Margin = new System.Windows.Forms.Padding(2); this.btnOpen.Name = "btnOpen"; this.btnOpen.Size = new System.Drawing.Size(56, 27); this.btnOpen.TabIndex = 1; @@ -49,7 +50,7 @@ // btnClose // this.btnClose.Location = new System.Drawing.Point(114, 60); - 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(56, 27); this.btnClose.TabIndex = 70; @@ -60,30 +61,41 @@ // childList // this.childList.FormattingEnabled = true; - this.childList.Location = new System.Drawing.Point(196, 60); - this.childList.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2); + this.childList.Location = new System.Drawing.Point(223, 60); + this.childList.Margin = new System.Windows.Forms.Padding(2); this.childList.Name = "childList"; - this.childList.Size = new System.Drawing.Size(166, 69); + this.childList.Size = new System.Drawing.Size(166, 264); this.childList.TabIndex = 71; // // MainTimer // this.MainTimer.Tick += new System.EventHandler(this.MainTimer_Tick); // + // lblNumChild + // + this.lblNumChild.AutoSize = true; + this.lblNumChild.Location = new System.Drawing.Point(18, 119); + this.lblNumChild.Name = "lblNumChild"; + this.lblNumChild.Size = new System.Drawing.Size(16, 13); + this.lblNumChild.TabIndex = 73; + this.lblNumChild.Text = "..."; + // // IOBManPanel // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(745, 596); + this.Controls.Add(this.lblNumChild); this.Controls.Add(this.childList); this.Controls.Add(this.btnClose); this.Controls.Add(this.btnOpen); this.IsMdiContainer = true; - 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); this.ResumeLayout(false); + this.PerformLayout(); } @@ -92,6 +104,7 @@ private System.Windows.Forms.Button btnClose; private System.Windows.Forms.ListBox childList; private System.Windows.Forms.Timer MainTimer; - } + private System.Windows.Forms.Label lblNumChild; + } } diff --git a/IOB-MAN/IOBManPanel.cs b/IOB-MAN/IOBManPanel.cs index 110fcfea..c742f6e0 100644 --- a/IOB-MAN/IOBManPanel.cs +++ b/IOB-MAN/IOBManPanel.cs @@ -12,6 +12,10 @@ namespace IOB_MAN /// Elenco dei processi /// protected Dictionary childFormList; + /// + /// Lista di IOB gestiti + /// + public List ElencoIOB = new List(); public IOBManPanel() { @@ -25,6 +29,11 @@ namespace IOB_MAN MainTimer.Start(); } + private void updateStatus() + { + // aggiorno labels + lblNumChild.Text = $"Avviati {childFormList.Count} / {childList.Items.Count} processi child"; + } /// /// apro eseguibile dump /// @@ -33,8 +42,10 @@ namespace IOB_MAN private void btnOpen_Click(object sender, EventArgs e) { apriChild(); + updateStatus(); } + private void apriChild() { string path = Application.StartupPath; @@ -70,15 +81,51 @@ namespace IOB_MAN private void btnClose_Click(object sender, EventArgs e) { chiudiChild(); + updateStatus(); } private void chiudiChild() { + int pid = -1; + string currSelection = ""; // recupero elenco processi (se almeno 1) if (childFormList.Count > 0) { KeyValuePair kvp = childFormList.First(); - int pid = kvp.Value.pID; + // se ce ne fosse uno selezionato uso quello... + try + { + currSelection = childList.SelectedItem.ToString(); + if (currSelection != null) + { + pid = childFormList[currSelection].pID; + } + else + { + pid = kvp.Value.pID; + } + } + catch + { + pid = kvp.Value.pID; + } + + } + else + { + try + { + currSelection = childList.SelectedItem.ToString(); + if (currSelection != null) + { + pid = childFormList[currSelection].pID; + } + } + catch + { } + } + if (pid >= 0) + { // provo a vedere SE ci sia il processo e di conseguenza lo chiudo... try { @@ -91,7 +138,7 @@ namespace IOB_MAN // errore era giĆ  chiuso.. } childList.Items.Remove(pid); - childFormList.Remove(kvp.Key); + childFormList.Remove(currSelection); } #if false // Get the current process.