/// <summary> /// appelle la fenetre de modification de l'unit séléctionné /// </summary> private void EditUnit(object sender, MouseButtonEventArgs e) { if (LB_units.SelectedItem is Unit u) { EditElementWindow third = new EditElementWindow(u); if (third.ShowDialog() == true) { DrawUnits(); storage.Update(notebook); } } }
/// <summary> /// appelle la fenetre de modification de l'unit séléctionné /// </summary> private void AddUnit(object sender, RoutedEventArgs e) { try { Unit newUnit = new Unit(); EditElementWindow third = new EditElementWindow(newUnit); if (third.ShowDialog() == true) { notebook.AddUnit(newUnit); storage.Update(notebook); DrawUnits(); } } catch (Exception x) { MessageBox.Show(x.Message); } }
/// <summary> /// ajoute a l'unit séléctionné un module /// </summary> private void AddModule(object sender, RoutedEventArgs e) { try { Module newModule = new Module(); EditElementWindow third = new EditElementWindow(newModule); if (third.ShowDialog() == true) { if (LB_units.SelectedItem is Unit unit) { unit.AddModule(newModule); storage.Update(notebook); DrawModules(); } } } catch (Exception x) { MessageBox.Show(x.Message); } }