/// <summary> /// 事件响应 /// </summary> internal static DelegateHandler <TEvent> On <TEvent>(this FrameworkElement uiElement, string description, LogEnum logType, Action <TEvent> action) where TEvent : IEvent { if (uiElement.Resources == null) { uiElement.Resources = new ResourceDictionary(); } List <IDelegateHandler> contextHandlers = (List <IDelegateHandler>)uiElement.Resources["ntminer_contextHandlers"]; if (contextHandlers == null) { contextHandlers = new List <IDelegateHandler>(); uiElement.Resources.Add("ntminer_contextHandlers", contextHandlers); uiElement.Unloaded += UiElement_Unloaded; } return(VirtualRoot.Path(description, logType, action).AddToCollection(contextHandlers)); }