public void Shutdown() { if (NewActivePatient != null) { foreach (Delegate d in NewActivePatient.GetInvocationList()) { NewActivePatient -= (NewActivePatientEventHandler)d; } } if (RelativeSelected != null) { foreach (Delegate d in RelativeSelected.GetInvocationList()) { RelativeSelected -= (RelativeSelectedEventHandler)d; } } if (AppointmentSelected != null) { foreach (Delegate d in AppointmentSelected.GetInvocationList()) { AppointmentSelected -= (AppointmentSelectedEventHandler)d; } } // remove patient model listeners if (activePatient != null) { activePatient.ReleaseProband(null); } this.MetaData.ReleaseListeners(null); }
private void ReleaseListenersForTarget(object target) { // remove local listerners if (NewActivePatient != null) { foreach (Delegate d in NewActivePatient.GetInvocationList()) { if (d.Target == target) { NewActivePatient -= (NewActivePatientEventHandler)d; } } } if (RelativeSelected != null) { foreach (Delegate d in RelativeSelected.GetInvocationList()) { if (d.Target == target) { RelativeSelected -= (RelativeSelectedEventHandler)d; } } } if (AppointmentSelected != null) { foreach (Delegate d in AppointmentSelected.GetInvocationList()) { if (d.Target == target) { AppointmentSelected -= (AppointmentSelectedEventHandler)d; } } } // remove patient model listeners if (activePatient != null) { activePatient.ReleaseProband(target); } this.MetaData.ReleaseListeners(target); }