/// <summary> /// Constructeur de la form ModifierArticle /// </summary> public ModifierArticle(FormMain Form, String PathToSave) { this.Form = Form; PathBdd = PathToSave; InitializeComponent(); Articles Ar = (Articles)Form.GetListView().SelectedItems[0].Tag; this.TextBoxDescription.Text = Ar.GetDescription(); AncienNom = Ar.GetDescription(); SousFamillesDAO SousFamillesD = new SousFamillesDAO(PathBdd); List <SousFamilles> SousFamillesList = SousFamillesD.GetAllSousFamilles(); //implémentation des combobox String SF = Form.GetListView().SelectedItems[0].SubItems[3].Text; foreach (SousFamilles Sf in SousFamillesList) { ComboBoxSousFamille.Items.Add(Sf); if (SF.Equals(Sf.GetNom())) { ComboBoxSousFamille.SelectedItem = ComboBoxSousFamille.Items[ComboBoxSousFamille.Items.IndexOf(Sf)]; } } MarquesDAO MarquesD = new MarquesDAO(PathBdd); List <Marques> MarquesList = MarquesD.GetAllMarques(); String M = Form.GetListView().SelectedItems[0].SubItems[4].Text; foreach (Marques Mar in MarquesList) { ComboBoxMarque.Items.Add(Mar); if (M.Equals(Mar.GetNom())) { ComboBoxMarque.SelectedItem = ComboBoxMarque.Items[ComboBoxMarque.Items.IndexOf(Mar)]; } } NumericUpDown.Value = Ar.GetQuantite(); }
public void PowerOn() { // Start the computer with the control until poiting at the first control word this.ControlUnit.OnControlStateUpdated(); ConsoleKeyInfo key; ValueFormat displayFormat = ValueFormat.Binary; while (true) { // Left modules this.Clock.OutputState(); Mar.OutputState(displayFormat); Ram.OutputState(displayFormat); Rom.OutputState(displayFormat); Ir.OutputState(displayFormat); IrParam.OutputState(displayFormat); // BUS this.Bus.OutputState(); // Right modules ProgramCounter.OutputState(displayFormat); A.OutputState(displayFormat); Alu.OutputState(displayFormat); B.OutputState(displayFormat); Flags.OutputState(displayFormat); Out.OutputState(displayFormat); // Control Unit (bottom) ControlUnit.OutputState(); // User keys Console.SetCursorPosition(0, 23); Console.Write(String.Format("[S]tep - [N]ext Ins - [R]un - Clock {0}hz [+-] - Rese[t] - [D]isplay - E[x]it", this.Clock.FrequencyHz)); // Step the system if (this.Clock.ClockMode == IClock.Mode.Stepped || (this.Clock.ClockMode == IClock.Mode.Running && Console.KeyAvailable)) { key = Console.ReadKey(true); int freq; switch (key.Key) { case ConsoleKey.S: this.Clock.ClockMode = IClock.Mode.Stepped; this.Clock.Step(); break; case ConsoleKey.R: this.Clock.ClockMode = IClock.Mode.Running; break; case ConsoleKey.N: this.Clock.ClockMode = IClock.Mode.Stepped; this.Clock.Step(); while (this.ControlUnit.MicrostepCounter.Value != 3 && !this.Clock.IsHalted) { Thread.Sleep(1); this.Clock.Step(); } break; case ConsoleKey.Add: freq = this.Clock.FrequencyHz; if (freq <= 20) { freq++; } else if (freq <= 100) { freq += 5; } else { freq += 50; } if (freq > 500) { freq = 500; } this.Clock.FrequencyHz = freq; break; case ConsoleKey.Subtract: freq = this.Clock.FrequencyHz; if (freq <= 20) { freq--; } else if (freq <= 100) { freq -= 5; } else { freq -= 50; } if (freq < 1) { freq = 1; } this.Clock.FrequencyHz = freq; break; case ConsoleKey.T: Reset(); break; case ConsoleKey.D: switch (displayFormat) { case ValueFormat.Hex: displayFormat = ValueFormat.Decimal; break; case ValueFormat.Decimal: displayFormat = ValueFormat.Binary; break; case ValueFormat.Binary: displayFormat = ValueFormat.Hex; break; } break; case ConsoleKey.X: return; } if (this.Clock.ClockMode == IClock.Mode.Stepped) { if (key.Key == ConsoleKey.S) { } } else if (this.Clock.ClockMode == IClock.Mode.Running) { } } if (this.Clock.ClockMode == IClock.Mode.Running) { if (Clock.IsHalted) { Thread.Sleep(1000); } else { Thread.Sleep(1000 / this.Clock.FrequencyHz); } this.Clock.Step(); } } }