private void NewButton_Click(object sender, RoutedEventArgs e) { FrmGenerationCtarcomp Newfrm = new FrmGenerationCtarcomp(); Newfrm.CallBack += Newfrm_CallBack; this.IsEnabled = false; Newfrm.Show(); }
void mnitem_Click(object sender, RoutedEventArgs e) { MenuItem mnitem = (MenuItem)sender; switch (mnitem.Header.ToString()) { case "Créer": FrmGenerationCtarcomp Newfrm = new FrmGenerationCtarcomp(); Newfrm.CallBack += Newfrm_CallBack; Newfrm.Show(); break; case "Dupliquer sur autre centre": { if (lbl_id_centre.Content != null) { new FrmTarifDuplication(int.Parse(lbl_id_centre.Content.ToString())).Show(); } else { Message.ShowInformation("Sélectionnez le centre origine", "Tarification"); return; } break; } //case "Consultation": // new FrmTarifFacturation((CsTarifFacturation)dgListeTarifFacturation.SelectedItem).Show(); // break; //case "Modification": // FrmTarifFacturation Updatefrm = new FrmTarifFacturation((CsTarifFacturation)dgListeTarifFacturation.SelectedItem, true); // Updatefrm.CallBack += Updatefrm_CallBack; // Updatefrm.Show(); // break; case "Supprimer": var messageBox = new MessageBoxControl.MessageBoxChildWindow("Attention", "Êtes-vous sûr de vouloir supprimer la ligne?", MessageBoxControl.MessageBoxButtons.OkCancel, MessageBoxControl.MessageBoxIcon.Information); messageBox.OnMessageBoxClosed += (_, result) => { if (messageBox.Result == MessageBoxResult.OK) { CsTarifFacturation LotsScelleRecuToDelete = (CsTarifFacturation)dgListeTarifFacturation.SelectedItem; TarifFacturationoDelete.Add(LotsScelleRecuToDelete); ListeTarifFacturation.Remove(LotsScelleRecuToDelete); } else { return; } }; messageBox.Show(); break; default: break; } }