/// <summary> /// Called when the event occurs. /// </summary> // ReSharper disable UnusedMember.Global public void OnEvent() // ReSharper restore UnusedMember.Global { EventOccurred.SafeInvoke(this); if (_handlerInstance != null) { var handlerMethodInfo = _handlerInstance.GetType().GetMethodEx(HandlerName, BindingFlagsHelper.GetFinalBindingFlags(true, false)); if (handlerMethodInfo == null) { throw Log.ErrorAndCreateException <NotSupportedException>("Cannot find the '{0}' method, implement the '{0}' method on '{1}'", EventName, _handlerInstance.GetType().Name); } handlerMethodInfo.Invoke(_handlerInstance, null); } }
/// <summary> /// Called when the event occurs. /// </summary> // ReSharper disable UnusedMember.Global public void OnEvent() // ReSharper restore UnusedMember.Global { EventOccurred.SafeInvoke(this, EventArgs.Empty); if (_handlerInstance != null) { var handlerMethodInfo = _handlerInstance.GetType().GetMethodEx(HandlerName, BindingFlagsHelper.GetFinalBindingFlags(true, false)); if (handlerMethodInfo == null) { string error = string.Format("Cannot find the '{0}' method, implement the '{0}' method on '{1}'", EventName, _handlerInstance.GetType().Name); Log.Error(error); throw new NotSupportedException(error); } handlerMethodInfo.Invoke(_handlerInstance, null); } }