Beispiel #1
0
 private void SessionChangeHandler_SessionChanged(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLogon || e.Reason == SessionSwitchReason.SessionUnlock)
     {
         NetworkChange_NetworkAddressChanged(null, EventArgs.Empty);
     }
 }
Beispiel #2
0
 /// <summary>
 /// Raise the StateChanged event.
 /// </summary>
 protected virtual void OnStateChanged(SessionSwitchEventArgs e)
 {
     if (StateChanged != null)
     {
         StateChanged(this, e);
     }
 }
Beispiel #3
0
 static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLogon)
     {
         BrowserLauncher.OpenDashboard(_appHost);
     }
 }
Beispiel #4
0
 void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock || e.Reason == SessionSwitchReason.SessionUnlock)
     {
         this.pressedKeySequence.Clear();
     }
 }
Beispiel #5
0
        private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            bool isUnlock = false;

            switch (e.Reason)
            {
            case SessionSwitchReason.RemoteConnect:
            case SessionSwitchReason.SessionLogon:
            case SessionSwitchReason.SessionRemoteControl:
                isUnlock = System.Windows.Forms.SystemInformation.TerminalServerSession;
                break;

            case SessionSwitchReason.SessionUnlock:
                isUnlock = true;
                break;

            default:
                break;
            }

            if (isUnlock)
            {
                this.CheckMaximumTime(true);
            }
        }
 private void WindowsSession_StateChanged(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionUnlock || e.Reason == SessionSwitchReason.SessionLock)
     {
         WindowState = WindowState.Minimized;
     }
 }
Beispiel #7
0
        void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLogon:
                Log.Write(LogLevel.Debug, "Detected session logon event.");
                _locked = false;
                break;

            case SessionSwitchReason.SessionLogoff:
                Log.Write(LogLevel.Debug, "Detected session logoff event.");
                _locked = true;
                break;

            case SessionSwitchReason.SessionLock:
                Log.Write(LogLevel.Debug, "Detected session lock event.");
                _locked = true;
                break;

            case SessionSwitchReason.SessionUnlock:
                Log.Write(LogLevel.Debug, "Detected session unlock event.");
                _locked = false;
                break;
            }
        }
Beispiel #8
0
        private void SessionSwitchHandler(object sender, SessionSwitchEventArgs e)
        {
            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLock:
                gallifrey.StartIdleTimer();
                break;

            case SessionSwitchReason.SessionUnlock:
                var idleTimerId = gallifrey.StopIdleTimer();
                var idleTimer   = gallifrey.IdleTimerCollection.GetTimer(idleTimerId);
                if (idleTimer.ExactCurrentTime.TotalSeconds < 15)
                {
                    MessageBox.Show("Machine Locked For Less Than 15 Seconds.\nIf Your Machine Went Into Screensaver Without Being Locked The Idle Time Cannot Be Captured", "Short Idle Time", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    gallifrey.IdleTimerCollection.RemoveTimer(idleTimerId);
                }
                else
                {
                    var idleTimerWindow = new IdleTimerWindow(gallifrey);
                    if (idleTimerWindow.DisplayForm)
                    {
                        idleTimerWindow.ShowDialog();
                        RefreshTimerPages();
                    }
                }
                break;
            }
        }
        private void SystemEvents_SessionSwitch(object sender, [NotNull] SessionSwitchEventArgs e)
        {
            StatusChangeEventType eventType;

            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLogoff:
                eventType = StatusChangeEventType.Logoff;
                break;

            case SessionSwitchReason.SessionLock:
                eventType = StatusChangeEventType.Lock;
                break;

            case SessionSwitchReason.SessionLogon:
                eventType = StatusChangeEventType.Logon;
                break;

            case SessionSwitchReason.SessionUnlock:
                eventType = StatusChangeEventType.Unlock;
                break;

            default:
                return;
            }

            var entity = new StatusChangeEvent
            {
                StatusChangeEventType = eventType
            };

            _statusChangeEventRepository.Insert(entity);
        }
Beispiel #10
0
        protected void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            SystemEventArgs ea = new SystemEventArgs();

            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLock:
                ea.newState = State.Lock;
                break;

            case SessionSwitchReason.SessionLogoff:
                ea.newState = State.Logoff;
                break;

            case SessionSwitchReason.SessionLogon:
                ea.newState = State.Logon;
                break;

            case SessionSwitchReason.SessionUnlock:
                ea.newState = State.Unlock;
                break;

            default:
                ea.newState = State.Unknown;
                break;
            }

            SessionEvent.RaiseMarshalled(this, ea);
        }
Beispiel #11
0
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         onWorkstationLocked();
     }
 }
 void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLogon)
     {
         //user logged in
     }
 }
Beispiel #13
0
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         isActive = false;
     }
     if (e.Reason == SessionSwitchReason.SessionLogoff)
     {
         isActive = false;
     }
     if (e.Reason == SessionSwitchReason.SessionLogon)
     {
         isActive = true;
     }
     if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         isActive = true;
     }
     if (e.Reason == SessionSwitchReason.RemoteConnect)
     {
         isActive = true;
     }
     if (e.Reason == SessionSwitchReason.RemoteDisconnect)
     {
         isActive = false;
     }
     if (e.Reason == SessionSwitchReason.ConsoleConnect)
     {
         isActive = true;
     }
     if (e.Reason == SessionSwitchReason.ConsoleDisconnect)
     {
         isActive = false;
     }
 }
Beispiel #14
0
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionUnlock)
     {   //for some reason, after resuming and unlocking, window Top position changes to 0
         FixTopPosition();
     }
 }
Beispiel #15
0
        void SystemEventsOnSessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            Debug.Assert(e != null);

            switch (e.Reason)
            {
            case SessionSwitchReason.ConsoleConnect:
            case SessionSwitchReason.RemoteConnect:
            case SessionSwitchReason.SessionUnlock:
                lock (countEventForSuspensions)
                {
                    if (sessionSuspension != null)
                    {
                        sessionSuspension.Dispose();
                        sessionSuspension = null;
                    }
                }
                break;

            case SessionSwitchReason.ConsoleDisconnect:
            case SessionSwitchReason.RemoteDisconnect:
            case SessionSwitchReason.SessionLock:
                lock (countEventForSuspensions)
                {
                    if (sessionSuspension == null)
                    {
                        sessionSuspension = Suspend();
                    }
                }
                break;
            }
        }
 void OnSystemEventsOnSessionSwitch(object sender, SessionSwitchEventArgs args)
 {
     if (args.Reason == SessionSwitchReason.SessionUnlock)
     {
         OnDesktopUnlockedEvent();
     }
 }
Beispiel #17
0
        /// <summary>Get the System Events</summary>
        /// <param name="sender"></param>
        /// <param name="e">The SessionSwitchEvent arguments</param>
        void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            //Collapse reasons to a simple locked / unlocked state
            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLock:
            case SessionSwitchReason.SessionLogoff:
            case SessionSwitchReason.ConsoleDisconnect:
            case SessionSwitchReason.RemoteDisconnect:
                SetUserState(SessionSwitchReason.SessionLock);
                break;

            case SessionSwitchReason.SessionUnlock:
            case SessionSwitchReason.SessionLogon:
            case SessionSwitchReason.ConsoleConnect:
            case SessionSwitchReason.RemoteConnect:
                SetUserState(SessionSwitchReason.SessionUnlock);
                break;

            case SessionSwitchReason.SessionRemoteControl:
                SetUserState(SessionSwitchReason.SessionRemoteControl);
                break;

            default:
                break;
            }

            HandleEvent("systemEvent_SessionSwitch", GetUserState(), Config.StateChangeLogEntryIncludesComputerDetail);
        }
Beispiel #18
0
        private void SessionSwitchHandler(object sender, SessionSwitchEventArgs e)
        {
            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLock:
            case SessionSwitchReason.SessionLogoff:
            case SessionSwitchReason.RemoteDisconnect:
            case SessionSwitchReason.ConsoleDisconnect:

                ViewModel.Gallifrey.StartIdleTimer();
                break;

            case SessionSwitchReason.SessionUnlock:
            case SessionSwitchReason.SessionLogon:
            case SessionSwitchReason.RemoteConnect:
            case SessionSwitchReason.ConsoleConnect:

                try
                {
                    var idleTimerId = ViewModel.Gallifrey.StopIdleTimer();
                    var idleTimer   = ViewModel.Gallifrey.IdleTimerCollection.GetTimer(idleTimerId);
                    if (idleTimer.IdleTimeValue.TotalSeconds < 60 || idleTimer.IdleTimeValue.TotalHours > 10)
                    {
                        ViewModel.Gallifrey.IdleTimerCollection.RemoveTimer(idleTimerId);
                    }
                    else
                    {
                        OpenFlyout(new LockedTimer(ViewModel));
                    }
                }
                catch (NoIdleTimerRunningException) { }

                break;
            }
        }
Beispiel #19
0
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionUnlock && Microbreak.ResetBreakOnWorkstationUnlock)
     {
         ResetCountdownToNextBreak();
     }
 }
Beispiel #20
0
 private void OnSystemSessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         RestartApplication();
     }
 }
Beispiel #21
0
        //private void M_refreshTimer_Tick(object sender, EventArgs e)
        //{
        //    this.InvalidateVisual();
        //}

        /// <summary>
        /// Called when the current session was switched.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="SessionSwitchEventArgs"/> instance containing the event data.</param>
        private void OnSystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            if (m_renderLoop == null)
            {
                return;
            }
            if (this.IsInDesignMode())
            {
                return;
            }

            switch (e.Reason)
            {
            // Handle session lock/unload events
            //  => Force recreation of view resources in that case
            case SessionSwitchReason.SessionUnlock:
            case SessionSwitchReason.SessionLock:
            case SessionSwitchReason.SessionLogon:
                if (m_renderLoop.IsRegisteredOnMainLoop)
                {
                    m_renderLoop.ViewConfiguration.ViewNeedsRefresh = true;
                }
                break;
            }
        }
Beispiel #22
0
 // Handle Logon Event
 void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (this.IsInitialized() && e.Reason.Equals(SessionSwitchReason.SessionUnlock))   // Only Update when Logged In
     {
         this.SendColorsToKeyboard(true);
     }
 }
Beispiel #23
0
        private void OnSessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            if (m_evHandler != null)
            {
                SessionLockReason r = SessionLockReason.Unknown;
                if (e.Reason == SessionSwitchReason.SessionLock)
                {
                    r = SessionLockReason.Lock;
                }
                else if (e.Reason == SessionSwitchReason.SessionLogoff)
                {
                    r = SessionLockReason.Ending;
                }
                else if (e.Reason == SessionSwitchReason.ConsoleDisconnect)
                {
                    r = SessionLockReason.UserSwitch;
                }
                else if ((e.Reason == SessionSwitchReason.SessionRemoteControl) ||
                         (e.Reason == SessionSwitchReason.RemoteConnect) ||
                         (e.Reason == SessionSwitchReason.RemoteDisconnect))
                {
                    r = SessionLockReason.RemoteControlChange;
                }

                if (r != SessionLockReason.Unknown)
                {
                    m_evHandler(sender, new SessionLockEventArgs(r));
                }
            }
        }
Beispiel #24
0
        void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            var workDay = GetWorkDay();

            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLock:
            {
                var screenOn = workDay.ScreenOns.FirstOrDefault(s => s.IsActive);
                if (screenOn != null)
                {
                    screenOn.EndTime  = DateTime.Now;
                    screenOn.IsActive = false;
                }
            }
            break;

            case SessionSwitchReason.SessionUnlock:
            {
                workDay.ScreenOns.Add(new TimeSpent(_clock));
            }
            break;
            }
            PopulateLogInTimes(workDay);
            Save();
        }
 static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLogon)
     {
         BrowserLauncher.OpenDashboard(_appHost.UserManager, _appHost.ServerConfigurationManager, _appHost, _logger);
     }
 }
Beispiel #26
0
 private void OnSessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (m_evHandler != null)
     {
         m_evHandler(sender, e);
     }
 }
Beispiel #27
0
 /// <summary>
 /// Detect when a session switch occurs
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         if (state == false)
         {
             EnableLedControl(true);
         }
         //Stop current effect
         tmrAnimation.Stop();
         SetFullLedColor(255, 0, 0);
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         if (state == false)
         {
             EnableLedControl(false);
         }
         else
         {
             //Resume current effect
             tmrAnimation.Start();
         }
     }
 }
Beispiel #28
0
        private async void OnSessionSwitch(Object sender, SessionSwitchEventArgs e)
        {
            try
            {
                _logger.LogTrace($"{Convert.ToString(e.Reason)}");

                Message message = null;

                if (e.Reason.Equals(SessionSwitchReason.SessionLock))
                {
                    message = new Message(Encoding.ASCII.GetBytes($"{Constants.Workstation.Messages.LOCKED} {this._deviceOwner}"));
                }
                else if (e.Reason.Equals(SessionSwitchReason.SessionUnlock))
                {
                    message = new Message(Encoding.ASCII.GetBytes($"{Constants.Workstation.Messages.UNLOCKED} {this._deviceOwner}"));
                }
                else if (e.Reason.Equals(SessionSwitchReason.SessionLogon))
                {
                    message = new Message(Encoding.ASCII.GetBytes($"{Constants.Workstation.Messages.LOGGEDIN} {this._deviceOwner}"));
                }
                else if (e.Reason.Equals(SessionSwitchReason.SessionLogoff))
                {
                    message = new Message(Encoding.ASCII.GetBytes($"{Constants.Workstation.Messages.LOGGEDOFF} {this._deviceOwner}"));
                }
                await _deviceClient.SendEventAsync(message);
            }
            catch (Exception exception)
            {
                _logger.LogCritical(exception, exception.Message);
            }
            finally
            {
            }
        }
        void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)

        {
            if (e.Reason == SessionSwitchReason.SessionLock)

            {
                this.isLocked = true;

                StopTimer();    // dont check for idle while locked

                OnWentIdle(new ActivityMonitorEventArgs(ActivityMonitorEventReason.DesktopLocked));

                Utility.WriteDebugInfo("system locked");
            }

            else if (e.Reason == SessionSwitchReason.SessionUnlock)

            {
                OnResumedActivity(new ActivityMonitorEventArgs(ActivityMonitorEventReason.DesktopUnlocked));

                this.isLocked = false;

                MaybeStartTimer();   // start checking for idle again

                Utility.WriteDebugInfo("system unlocked");
            }
        }
Beispiel #30
0
 static void HandleLock(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         Process.Start("shutdown", "/f /s /t 0");
     }
 }