예제 #1
0
        // 因为是上下文路径,无需返回路径标识
        public static void AppContextEventPath <TEvent>(string description, LogEnum logType, Action <TEvent> action)
            where TEvent : IEvent
        {
            var messagePathId = VirtualRoot.BuildPath(description, logType, action);

            _contextHandlers.Add(messagePathId);
        }
예제 #2
0
        // 因为是上下文路径,无需返回路径标识
        public static void AppContextCmdPath <TCmd>(string description, LogEnum logType, Action <TCmd> action)
            where TCmd : ICmd
        {
            var messagePathId = VirtualRoot.BuildPath(description, logType, action);

            _contextHandlers.Add(messagePathId);
        }
예제 #3
0
        // 因为是上下文路径,无需返回路径标识
        public static void BuildEventPath <TEvent>(this Window window, string description, LogEnum logType, Action <TEvent> action)
            where TEvent : IEvent
        {
            if (WpfUtil.IsInDesignMode)
            {
                return;
            }
            if (window.Resources == null)
            {
                window.Resources = new ResourceDictionary();
            }
            List <IMessagePathId> messagePathIds = (List <IMessagePathId>)window.Resources[messagePathIdsResourceKey];

            if (messagePathIds == null)
            {
                messagePathIds = new List <IMessagePathId>();
                window.Resources.Add(messagePathIdsResourceKey, messagePathIds);
                window.Closed += UiElement_Closed;;
            }
            var messagePathId = VirtualRoot.BuildPath(description, logType, action);

            messagePathIds.Add(messagePathId);
        }