public void SessionChanged(HostControl hostControl, SessionChangedArguments arguments)
 {
     if (_sessionChanged != null)
     {
         _sessionChanged(_service, hostControl, arguments);
     }
 }
Beispiel #2
0
        public void SessionChange(HostControl hostControl, SessionChangedArguments args)
        {
            var sid  = (uint)args.SessionId;
            var kind = Kind.Unknown;

            switch (args.ReasonCode)
            {
            // Kind.Active to store latest active time span when user ends work
            case SessionChangeReasonCode.ConsoleDisconnect:
            case SessionChangeReasonCode.RemoteDisconnect:
            case SessionChangeReasonCode.SessionLock:
            case SessionChangeReasonCode.SessionLogoff:
                kind = Kind.Active;
                break;

            // Kind.Connected to reset Accounter and start watching for user time since connected state
            case SessionChangeReasonCode.ConsoleConnect:
            case SessionChangeReasonCode.RemoteConnect:
            case SessionChangeReasonCode.SessionLogon:
            case SessionChangeReasonCode.SessionUnlock:
                kind = Kind.Connected;
                break;
            }
            if (kind != Kind.Unknown)
            {
                _accounter.Changed(new SessionData(sid, kind, this)
                {
                    User = SessionInformation.GetUsernameBySessionId(sid, false)
                });
            }
        }
Beispiel #3
0
            public void SessionChanged(HostControl hostControl, SessionChangedArguments arguments)
            {
                var sessionChange = _service as ServiceSessionChange;

                if (sessionChange != null)
                {
                    sessionChange.SessionChange(hostControl, arguments);
                }
            }
        public void SessionChanged(SessionChangedArguments e)
        {
            var unlocked = e.ReasonCode == SessionChangeReasonCode.ConsoleConnect ||
                           e.ReasonCode == SessionChangeReasonCode.RemoteConnect ||
                           e.ReasonCode == SessionChangeReasonCode.SessionLogon ||
                           e.ReasonCode == SessionChangeReasonCode.SessionRemoteControl ||
                           e.ReasonCode == SessionChangeReasonCode.SessionUnlock;

            //changeDescription.Reason == SessionChangeReason.SessionLogon ||
            //         changeDescription.Reason == SessionChangeReason.SessionUnlock;
            SessionManager.Unlocked = unlocked;
            LocalLogger.Log($"{e.ReasonCode}. Unlocked: {unlocked}");
            HubService.LogOnPage($"Session changed to {e.ReasonCode}");
        }
 public void SessionChanged(HostControl hostControl, SessionChangedArguments arguments)
 {
     _serviceHandle.SessionChanged(hostControl, arguments);
 }
Beispiel #6
0
 public void SessionChange(HostControl hostControl, SessionChangedArguments changedArguments)
 {
     _log.Info("Service session changed");
 }
Beispiel #7
0
        public void SessionChanged(SessionChangedArguments args)
        {
            lock (Config.timeLock)
            {
                switch (args.ReasonCode)
                {
                case Topshelf.SessionChangeReasonCode.SessionLock:
                    Utilities.Log(string.Format("Session: {0} - Reason: {1} - Lock", args.SessionId, args.ReasonCode));
                    Config.isUserLoggedIn   = false;
                    Config.computerIsLocked = true;
                    Config.currentSessionId = args.SessionId;
                    Config.isUserIdle       = true;

                    if (Config.settings.resumePausedMiningOnLockOrLogoff)
                    {
                        Config.isMiningPaused = false;
                    }

                    break;

                case Topshelf.SessionChangeReasonCode.SessionLogoff:
                    Config.isUserLoggedIn = false;
                    Utilities.Log(string.Format("Session: {0} - Reason: {1} - Logoff", args.SessionId, args.ReasonCode));
                    Config.currentSessionId = 0;
                    Config.isUserIdle       = true;

                    if (Config.settings.resumePausedMiningOnLockOrLogoff)
                    {
                        Config.isMiningPaused = false;
                    }

                    break;

                case Topshelf.SessionChangeReasonCode.SessionUnlock:
                case Topshelf.SessionChangeReasonCode.ConsoleConnect:
                    Config.isUserLoggedIn   = true;
                    Config.computerIsLocked = false;
                    Utilities.Log(string.Format("Session: {0} - Reason: {1} - Unlock", args.SessionId, args.ReasonCode));
                    Config.currentSessionId = args.SessionId;
                    Config.isUserIdle       = false;
                    break;

                case Topshelf.SessionChangeReasonCode.SessionLogon:
                    Config.isUserLoggedIn   = true;
                    Config.computerIsLocked = false;
                    Utilities.Log(string.Format("Session: {0} - Reason: {1} - Login", args.SessionId, args.ReasonCode));
                    Config.currentSessionId = args.SessionId;
                    Config.isUserIdle       = false;
                    break;

                case Topshelf.SessionChangeReasonCode.RemoteDisconnect:
                    Config.isUserLoggedIn   = false;
                    Config.computerIsLocked = true;
                    Utilities.Log(string.Format("Session: {0} - Reason: {1} - RemoteDisconnect", args.SessionId, args.ReasonCode));
                    Config.currentSessionId          = args.SessionId;
                    Config.remoteDisconnectedSession = args.SessionId;
                    Config.isUserIdle = true;

                    if (Config.currentSessionId == 0)
                    {
                        if (Config.settings.resumePausedMiningOnLockOrLogoff)
                        {
                            Config.isMiningPaused = false;
                        }
                    }

                    return;

                case Topshelf.SessionChangeReasonCode.RemoteConnect:
                    Config.isUserLoggedIn   = true;
                    Config.computerIsLocked = false;
                    Utilities.Log(string.Format("Session: {0} - Reason: {1} - RemoteConnect", args.SessionId, args.ReasonCode));
                    Config.currentSessionId = ProcessExtensions.GetSession();
                    Config.isUserIdle       = false;
                    break;

                default:
                    Utilities.Debug(string.Format("Session: {0} - Other - Reason: {1}", args.SessionId, args.ReasonCode));
                    break;
                }
                Config.remoteDisconnectedSession = -1;
                Config.fullscreenDetected        = false;
                Utilities.KillMiners();
                Utilities.KillProcess(Config.idleMonExecutable);
                Config.cpuUsageQueue = new Queue <int>();
            }
        }
Beispiel #8
0
 public void HandleEvent(HostControl hostControl, SessionChangedArguments arg3)
 {
     HandleMonitor();
 }
Beispiel #9
0
 public void SessionChanged(HostControl hostControl, SessionChangedArguments arguments)
 {
     _serviceHandle.SessionChanged(hostControl, arguments);
 }
Beispiel #10
0
 public void SessionChanged(HostControl hostControl, SessionChangedArguments arguments)
 {
 }
Beispiel #11
0
 public void SessionChange(HostControl hostControl, SessionChangedArguments changedArguments)
 {
     _log.Info("Service session changed");
 }
Beispiel #12
0
 public void SessionChanged(SessionChangedArguments e)
 {
     Console.WriteLine(e.ReasonCode);
 }
Beispiel #13
0
 public void OnSessionChanged(SessionChangedArguments args)
 {
     Debugger.Log(1, "session", "Session changed");
     File.AppendAllText(STD_ERR, $"Time:{DateTime.Now.ToShortTimeString()}\tMessage:SessionChanged to:" + args.SessionId);
 }
Beispiel #14
0
        private static void OnSessionChanged(IActivityTrackerService trackerService, HostControl host, SessionChangedArguments arg)
        {
            switch (arg.ReasonCode)
            {
            case SessionChangeReasonCode.SessionLogon:
                trackerService.OnLogon();
                break;

            case SessionChangeReasonCode.SessionLogoff:
                trackerService.OnLogoff();
                break;

            case SessionChangeReasonCode.SessionLock:
                trackerService.OnLock();
                break;

            case SessionChangeReasonCode.SessionUnlock:
                trackerService.Unlock();
                break;
            }
        }
Beispiel #15
0
 public void HandleEvent(HostControl hostControl, SessionChangedArguments arg3)
 {
     HandleMonitor();
 }
        public void SessionChanged(HostControl hostControl, SessionChangedArguments arguments)
        {
            var control = new AppDomainHostControl(this);

            _service.SessionChanged(control, arguments);
        }