private void AddProductionToIHM(Production production) { enregistrerToolStripMenuItem.Enabled = true; panelAddCaisse.Visible = false; ucAddCaisseQuest.TypeCaisseToAdd = ""; ucAddCaisseQuest.NbCaisseToAdd = ""; TabPage tabPage = new TabPage("Production " + production.Type); tabPage.Name = "Production" + production.Type; UCPageProduction pageProd = new UCPageProduction(); pageProd.Name = production.Type.ToString(); tabPage.Controls.Add(pageProd); tabControlProd.Controls.Add(tabPage); ToolStripItem item = new ToolStripMenuItem(production.Type.ToString(), null, DemarrerProd); item.Name = "Start" + production.Type; demarrerToolStripMenuItem.DropDownItems.Add(item); ToolStripItem item1 = new ToolStripMenuItem(production.Type.ToString(), null, ContinueProd); item1.Name = "Continue" + production.Type; continuerToolStripMenuItem.DropDownItems.Add(item1); ToolStripItem item2 = new ToolStripMenuItem(production.Type.ToString(), null, SuspendreProd); item2.Name = "Stop" + production.Type; arrêterToolStripMenuItem.DropDownItems.Add(item2); UCProgressionProduction uC = new UCProgressionProduction(); uC.Name = production.Type.ToString(); uC.NomProduction += " " + uC.Name; panelProgressBar.Controls.Add(uC); ToolStripStatusLabel toolStrip = new ToolStripStatusLabel($"Production {production.Type} : {production.EtatCourantDeLaProduction} || "); statusStripProd.Items.Add(toolStrip); UpdateIHM(production); }
private void UpdateIHM(Production production) { if (production.EtatCourantDeLaProduction == EnumEtatProduction.AttenteDemarrage) { demarrerToolStripMenuItem.DropDownItems["Start" + production.Type].Enabled = true; continuerToolStripMenuItem.DropDownItems["Continue" + production.Type].Enabled = false; arrêterToolStripMenuItem.DropDownItems["Stop" + production.Type].Enabled = false; } else if (production.EtatCourantDeLaProduction == EnumEtatProduction.Suspendu) { demarrerToolStripMenuItem.DropDownItems["Start" + production.Type].Enabled = false; continuerToolStripMenuItem.DropDownItems["Continue" + production.Type].Enabled = true; arrêterToolStripMenuItem.DropDownItems["Stop" + production.Type].Enabled = false; } else if (production.EtatCourantDeLaProduction == EnumEtatProduction.EnCours) { demarrerToolStripMenuItem.DropDownItems["Start" + production.Type].Enabled = false; continuerToolStripMenuItem.DropDownItems["Continue" + production.Type].Enabled = false; arrêterToolStripMenuItem.DropDownItems["Stop" + production.Type].Enabled = true; } else { demarrerToolStripMenuItem.DropDownItems["Start" + production.Type].Enabled = false; continuerToolStripMenuItem.DropDownItems["Continue" + production.Type].Enabled = false; arrêterToolStripMenuItem.DropDownItems["Stop" + production.Type].Enabled = false; } UCProgressionProduction uc = (UCProgressionProduction)this.panelProgressBar.Controls[production.Type.ToString()]; uc.ValeurBarreProgression = production.GetPourcentageProductionTerminate(); UCPageProduction uCPage = (UCPageProduction)this.tabControlProd.Controls["Production" + production.Type.ToString()].Controls[production.Type.ToString()]; uCPage.NombreCaisseDepuisDemarrage = production.NbCaissesProduite.ToString(); uCPage.NombreErreur = production.NbCaissesNonConforme.ToString(); uCPage.TauxDefautDemarrage = production.GetTauxErreurDemarrage().ToString("0.0000"); }