private void Subscribe() { if (AssociatedObject == null || string.IsNullOrWhiteSpace(EventName)) { return; } Unsubscribe(); anyEventHandler = new AnyEventHandler(AssociatedObject, EventName); anyEventHandler.EventRaise += AnyEventHandler_EventRaise; }
private void Unsubscribe() { if (AssociatedObject == null) { return; } if (anyEventHandler != null) { anyEventHandler.EventRaise -= AnyEventHandler_EventRaise; anyEventHandler.Dispose(); anyEventHandler = null; } }