//Medicine Register Group --- Card 2 private void UCMedicineRegisterLeftClick(object sender, RoutedEventArgs e) { if (ct.Ping()) { if (MRW == null) { MRW = new MedicinEntryWindow(); MRW.onCloserUpdate = RefreshCounters; //a delegate method from MedicinEntryWindow MRW.Closing += MRW_Closing;; MRW.ControlTheme = currntTheme; OpendWindowElement opp2 = new OpendWindowElement("Medicine Register Window"); opp2.ControlTheme = currntTheme; opp2.closebtnHandaler += Opp2_closebtnHandaler; opp2.showbtnHandaler += Opp2_showbtnHandaler; RegisterName("MRW", opp2); OpenWindowNameHolder.Children.Add(opp2); } MRW.Show(); MRW.WindowState = WindowState.Normal; MRW.Focus(); } else { MessageBox.Show("Not Connected!"); } }
private void MRW_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (MRW != null) { CloseMedicineRegForm(); } MRW = null; }