/// <summary> /// Return a delegate which can be added to the targetProperty /// </summary> /// <returns>An event hander, which, when invoked, will invoke the action</returns> public Delegate GetDelegate() { Delegate del = null; foreach (var invokeCommandMethodInfo in invokeCommandMethodInfos) { del = Delegate.CreateDelegate(this.eventHandlerType, this, invokeCommandMethodInfo, false); if (del != null) { break; } } if (del == null) { var msg = String.Format("Event being bound to does not have a signature we know about. Method {0} on target {1}. Valid signatures are:" + "Valid signatures are:\n" + " - '(object sender, EventArgsOrSubclass e)'\n" + " - '(object sender, DependencyPropertyChangedEventArgs e)'", this.MethodName, this.Target); var e = new ActionEventSignatureInvalidException(msg); logger.Error(e); throw e; } return(del); }
/// <summary> /// Return a delegate which can be added to the targetProperty /// </summary> /// <returns>An event hander, which, when invoked, will invoke the action</returns> public Delegate GetDelegate() { Delegate del = null; foreach (var invokeCommandMethodInfo in invokeCommandMethodInfos) { del = Delegate.CreateDelegate(this.eventHandlerType, this, invokeCommandMethodInfo, false); if (del != null) break; } if (del == null) { var msg = String.Format("Event being bound to does not have a signature we know about. Method {0} on target {1}. Valid signatures are:" + "Valid signatures are:\n" + " - '(object sender, EventArgsOrSubclass e)'\n" + " - '(object sender, DependencyPropertyChangedEventArgs e)'", this.MethodName, this.Target); var e = new ActionEventSignatureInvalidException(msg); logger.Error(e); throw e; } return del; }