bozza gestione elencoIOB

This commit is contained in:
Samuele E. Locatelli
2019-12-21 09:52:02 +01:00
parent 84e00a7a4b
commit 2afe1ead7b
2 changed files with 39 additions and 2 deletions
+16
View File
@@ -34,6 +34,8 @@
this.childList = new System.Windows.Forms.ListBox();
this.MainTimer = new System.Windows.Forms.Timer(this.components);
this.lblNumChild = new System.Windows.Forms.Label();
this.dgvManagedItems = new System.Windows.Forms.DataGridView();
((System.ComponentModel.ISupportInitialize)(this.dgvManagedItems)).BeginInit();
this.SuspendLayout();
//
// btnOpen
@@ -80,11 +82,23 @@
this.lblNumChild.TabIndex = 73;
this.lblNumChild.Text = "...";
//
// dgvManagedItems
//
this.dgvManagedItems.AllowUserToAddRows = false;
this.dgvManagedItems.AllowUserToDeleteRows = false;
this.dgvManagedItems.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dgvManagedItems.Location = new System.Drawing.Point(420, 60);
this.dgvManagedItems.Name = "dgvManagedItems";
this.dgvManagedItems.ReadOnly = true;
this.dgvManagedItems.Size = new System.Drawing.Size(240, 150);
this.dgvManagedItems.TabIndex = 75;
//
// 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.dgvManagedItems);
this.Controls.Add(this.lblNumChild);
this.Controls.Add(this.childList);
this.Controls.Add(this.btnClose);
@@ -94,6 +108,7 @@
this.Name = "IOBManPanel";
this.Text = "IOB MANAGER";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.IOBManPanel_FormClosing);
((System.ComponentModel.ISupportInitialize)(this.dgvManagedItems)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@@ -105,6 +120,7 @@
private System.Windows.Forms.ListBox childList;
private System.Windows.Forms.Timer MainTimer;
private System.Windows.Forms.Label lblNumChild;
private System.Windows.Forms.DataGridView dgvManagedItems;
}
}
+23 -2
View File
@@ -13,9 +13,9 @@ namespace IOB_MAN
/// </summary>
protected Dictionary<string, iobAdapt> childFormList;
/// <summary>
/// Lista di IOB gestiti
/// Binding source degli elementi gestiti..
/// </summary>
public List<iobAdapt> ElencoIOB = new List<iobAdapt>();
private BindingSource ElencoIOB = new BindingSource();
public IOBManPanel()
{
@@ -26,13 +26,29 @@ namespace IOB_MAN
private void myInit()
{
childFormList = new Dictionary<string, iobAdapt>();
// gestione eventi binding source
ElencoIOB.AddingNew += ElencoIOB_AddingNew;
ElencoIOB.ListChanged += ElencoIOB_ListChanged;
// colelgo tab a binding
dgvManagedItems.DataSource = ElencoIOB;
MainTimer.Start();
}
private void ElencoIOB_ListChanged(object sender, System.ComponentModel.ListChangedEventArgs e)
{
updateStatus();
}
private void ElencoIOB_AddingNew(object sender, System.ComponentModel.AddingNewEventArgs e)
{
updateStatus();
}
private void updateStatus()
{
// aggiorno labels
lblNumChild.Text = $"Avviati {childFormList.Count} / {childList.Items.Count} processi child";
//dgvManagedItems.bind
}
/// <summary>
/// apro eseguibile dump
@@ -71,6 +87,8 @@ namespace IOB_MAN
childFormList.Add(newIob.CodIOB, newIob);
// aggiorno elenco...
childList.Items.Add(p.Id);
// aggiungo a datasource
ElencoIOB.Add(newIob);
}
/// <summary>
@@ -137,6 +155,9 @@ namespace IOB_MAN
{
// errore era già chiuso..
}
// rimuovo da datasource
ElencoIOB.Remove(childFormList[currSelection]);
// rimuovo altri
childList.Items.Remove(pid);
childFormList.Remove(currSelection);
}