void ShowViolationWindow(object param) { _violationWindow = new ProtocolViolationView(SelectedViolation); _violationWindow.Closed += OnViolationWindow_Closed; EventHandler violCloseHandler = null; violCloseHandler = delegate { _violationWindow.Close(); SelectedViolation.RequestClose -= violCloseHandler; }; SelectedViolation.RequestClose += violCloseHandler; _violationWindow.Show(); }
void ShowProtocolViolation(object param) { var viol = new ProtocolViolationModel { Participant = SelectedParticipant.ParticipantModel }; var violVM = new ProtocolViolationViewModel(_repository, viol); var violView = new ProtocolViolationView(violVM); EventHandler violCloseHandler = null; violCloseHandler = delegate { violView.Close(); violVM.RequestClose -= violCloseHandler; }; violVM.RequestClose += violCloseHandler; violView.ShowDialog(); }
void OnViolationWindow_Closed(object sender, EventArgs e) { _violationWindow.Closed -= OnViolationWindow_Closed; _violationWindow = null; }