ntminer 6 tahun lalu
induk
melakukan
d532470a68

+ 2 - 4
src/AppModels/AppContext.cs

@@ -19,21 +19,19 @@ namespace NTMiner {
         /// <summary>
         /// 命令窗口。使用该方法的代码行应将前两个参数放在第一行以方便vs查找引用时展示出参数信息
         /// </summary>
-        public static IMessagePathId CmdPath<TCmd>(string description, LogEnum logType, Action<TCmd> action)
+        public static void CmdPath<TCmd>(string description, LogEnum logType, Action<TCmd> action)
             where TCmd : ICmd {
             var messagePathId = VirtualRoot.BuildPath(description, logType, action);
             _contextHandlers.Add(messagePathId);
-            return messagePathId;
         }
 
         /// <summary>
         /// 事件响应
         /// </summary>
-        public static IMessagePathId EventPath<TEvent>(string description, LogEnum logType, Action<TEvent> action)
+        public static void EventPath<TEvent>(string description, LogEnum logType, Action<TEvent> action)
             where TEvent : IEvent {
             var messagePathId = VirtualRoot.BuildPath(description, logType, action);
             _contextHandlers.Add(messagePathId);
-            return messagePathId;
         }
 
         public static void Enable() {

+ 1 - 1
src/AppModels/Vms/StartStopMineButtonViewModel.cs

@@ -44,7 +44,7 @@ namespace NTMiner.Vms {
                 this.MinerProfile.IsMining = true;
                 int n = MinerProfile.AutoStartDelaySeconds;
                 IMessagePathId handler = null;
-                handler = AppContext.EventPath<Per1SecondEvent>("挖矿倒计时", LogEnum.None,
+                handler = VirtualRoot.BuildEventPath<Per1SecondEvent>("挖矿倒计时", LogEnum.None,
                 action: message => {
                     if (NTMinerRoot.IsAutoStartCanceled) {
                         BtnStopText = $"尚未开始";

+ 2 - 2
src/NTMiner/INTMinerRoot.cs

@@ -11,8 +11,8 @@ using System.Collections.Generic;
 
 namespace NTMiner {
     public interface INTMinerRoot {
-        IMessagePathId ServerContextCmdPath<TCmd>(string description, LogEnum logType, Action<TCmd> action) where TCmd : ICmd;
-        IMessagePathId ServerContextEventPath<TEvent>(string description, LogEnum logType, Action<TEvent> action) where TEvent : IEvent;
+        void ServerContextCmdPath<TCmd>(string description, LogEnum logType, Action<TCmd> action) where TCmd : ICmd;
+        void ServerContextEventPath<TEvent>(string description, LogEnum logType, Action<TEvent> action) where TEvent : IEvent;
         
         void ReInitMinerProfile();
 

+ 2 - 4
src/NTMiner/NTMinerRoot.cs

@@ -31,21 +31,19 @@ namespace NTMiner {
         /// <summary>
         /// 命令窗口。使用该方法的代码行应将前两个参数放在第一行以方便vs查找引用时展示出参数信息
         /// </summary>
-        public IMessagePathId ServerContextCmdPath<TCmd>(string description, LogEnum logType, Action<TCmd> action)
+        public void ServerContextCmdPath<TCmd>(string description, LogEnum logType, Action<TCmd> action)
             where TCmd : ICmd {
             var messagePathId = VirtualRoot.BuildPath(description, logType, action);
             _serverContextHandlers.Add(messagePathId);
-            return messagePathId;
         }
 
         /// <summary>
         /// 事件响应
         /// </summary>
-        public IMessagePathId ServerContextEventPath<TEvent>(string description, LogEnum logType, Action<TEvent> action)
+        public void ServerContextEventPath<TEvent>(string description, LogEnum logType, Action<TEvent> action)
             where TEvent : IEvent {
             var messagePathId = VirtualRoot.BuildPath(description, logType, action);
             _serverContextHandlers.Add(messagePathId);
-            return messagePathId;
         }
 
         public IUserSet UserSet { get; private set; }