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

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

            _contextPathIds.Add(messagePathId);
        }
Example #3
0
        public static void AddCmdPath <TCmd>(this Window window, LogEnum logType, Action <TCmd> action, Type location)
            where TCmd : ICmd
        {
            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;
            }
            MessageTypeAttribute messageTypeDescription = MessageTypeAttribute.GetMessageTypeAttribute(typeof(TCmd));
            string description   = "处理" + messageTypeDescription.Description;
            var    messagePathId = VirtualRoot.AddMessagePath(description, logType, action, location);

            messagePathIds.Add(messagePathId);
        }
Example #4
0
        public static void AddEventPath <TEvent>(this Window window, string description, LogEnum logType, Action <TEvent> action, Type location)
            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.AddMessagePath(description, logType, action, location);

            messagePathIds.Add(messagePathId);
        }