Esempio n. 1
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);
        }
Esempio n. 2
0
        private void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)
        {
            SystemEventArgs ea = new SystemEventArgs();

            switch (e.Mode)
            {
            case PowerModes.Resume:
                ea.newState = State.Resume;
                break;

            case PowerModes.Suspend:
                ea.newState = State.Suspend;
                break;
            }
            SessionEvent.RaiseMarshalled(this, ea);
        }
Esempio n. 3
0
        protected void SystemEvents_SessionEnding(object sender, SessionEndingEventArgs e)
        {
            SystemEventArgs ea = new SystemEventArgs();

            switch (e.Reason)
            {
            case SessionEndReasons.Logoff:
                ea.newState = State.Logoff;
                break;

            case SessionEndReasons.SystemShutdown:
                ea.newState = State.Shutdown;
                break;

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

            SessionEvent.RaiseMarshalled(this, ea);
        }