Exemplo n.º 1
0
 private NTMinerContext()
 {
     CreatedOn       = DateTime.Now;
     LocalMessageSet = new LocalMessageSet();
     if (ClientAppType.IsMinerClient)
     {
         SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;
     }
     VirtualRoot.BuildEventPath <AppExitEvent>($"程序退出时的{nameof(NTMinerContext)}退出逻辑", LogEnum.None,
                                               message => {
         if (LockedMineContext != null)
         {
             StopMine(StopMineReason.ApplicationExit);
         }
         SystemEvents.SessionSwitch -= SystemEvents_SessionSwitch;
     }, typeof(NTMinerContext));
 }
Exemplo n.º 2
0
        private NTMinerContext()
        {
            CreatedOn       = DateTime.Now;
            LocalMessageSet = new LocalMessageSet();
            if (ClientAppType.IsMinerClient)
            {
                SystemEvents.SessionSwitch += SystemEvents_SessionSwitch;

                VirtualRoot.BuildEventPath <UserActionEvent>("发生了用户活动时检查serverJson是否有新版本", LogEnum.DevConsole,
                                                             path: message => {
                    RefreshServerJsonFile();
                }, location: this.GetType());
            }
            VirtualRoot.BuildEventPath <AppExitEvent>($"程序退出时的{nameof(NTMinerContext)}退出逻辑", LogEnum.None,
                                                      message => {
                if (LockedMineContext != null)
                {
                    StopMine(StopMineReason.ApplicationExit);
                }
                SystemEvents.SessionSwitch -= SystemEvents_SessionSwitch;
            }, typeof(NTMinerContext));
        }