void DoNotify(string propertyName) { PropertyChangedEventHandler h = this.PropertyChanged; if (h != null) { h.BeginInvoke(this, new PropertyChangedEventArgs(propertyName), null, null); } }
/// <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)); }
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); } }