public void FindPluginInType(Type type) { EventAttribute invokeInfoAttr = type.GetCustomAttributes(typeof(EventAttribute), false).FirstOrDefault <object>() as EventAttribute; if ((invokeInfoAttr != null) && (!string.IsNullOrWhiteSpace(invokeInfoAttr.PageName) && !string.IsNullOrWhiteSpace(invokeInfoAttr.Key))) { eventCallDict.Add(invokeInfoAttr, type); } }
public void Add(EventAttribute invokeInfoAttr, Type type) { if (string.IsNullOrWhiteSpace(invokeInfoAttr.PageName)) { throw new ApplicationException("插件的PageName为空"); } if (string.IsNullOrWhiteSpace(invokeInfoAttr.Key)) { throw new ApplicationException("插件的Key为空"); } string lowerPageName = invokeInfoAttr.PageName.ToLower(); this.SurePageDict(lowerPageName).Add(invokeInfoAttr, type); }
public EventCallHandlerItem(EventAttribute invoke_attr, Type handler_type) { this.InvokeInfo = invoke_attr; this.HandlerType = handler_type; this.EventCallHandler = Activator.CreateInstance(handler_type) as IEventCallHandler; }
public void Add(EventAttribute invokeInfoAttr, Type handlerType) { this.SureButtonEventCallHandler(invokeInfoAttr.Key).Add(new EventCallHandlerItem(invokeInfoAttr, handlerType)); }