示例#1
0
        private void Subscribe()
        {
            if (AssociatedObject == null || string.IsNullOrWhiteSpace(EventName))
            {
                return;
            }
            Unsubscribe();

            anyEventHandler             = new AnyEventHandler(AssociatedObject, EventName);
            anyEventHandler.EventRaise += AnyEventHandler_EventRaise;
        }
示例#2
0
 private void Unsubscribe()
 {
     if (AssociatedObject == null)
     {
         return;
     }
     if (anyEventHandler != null)
     {
         anyEventHandler.EventRaise -= AnyEventHandler_EventRaise;
         anyEventHandler.Dispose();
         anyEventHandler = null;
     }
 }