예제 #1
0
        void DoNotify(string propertyName)
        {
            PropertyChangedEventHandler h = this.PropertyChanged;

            if (h != null)
            {
                h.BeginInvoke(this, new PropertyChangedEventArgs(propertyName), null, null);
            }
        }
예제 #2
0
        /// <summary>
        /// Extends BeginInvoke so that when a state object is not needed, null does not need to be passed.
        /// <example>
        /// propertychangedeventhandler.BeginInvoke(sender, e, callback);
        /// </example>
        /// </summary>
        public static IAsyncResult BeginInvoke(this PropertyChangedEventHandler propertychangedeventhandler, Object sender, PropertyChangedEventArgs e, AsyncCallback callback)
        {
            if (propertychangedeventhandler == null)
            {
                throw new ArgumentNullException("propertychangedeventhandler");
            }

            return(propertychangedeventhandler.BeginInvoke(sender, e, callback, null));
        }
예제 #3
0
 public static void InvokeEventHandlerAsync(PropertyChangedEventHandler eventHandler, object sender, PropertyChangedEventArgs e)
 {
     if ((object)eventHandler == null)
     {
         throw new ArgumentNullException("eventHandler");
     }
     System.Delegate[] invocationList = eventHandler.GetInvocationList();
     for (int i = 0; i < invocationList.Length; i++)
     {
         PropertyChangedEventHandler currentEventHandler = (PropertyChangedEventHandler)invocationList[i];
         currentEventHandler.BeginInvoke(sender, e, new AsyncCallback(currentEventHandler.EndInvoke), null);
     }
 }