コード例 #1
0
 /// <summary>
 /// Handles the SessionSwitch event of the SystemEvents control.
 /// </summary>
 /// <param name="sender">The source of the event.</param>
 /// <param name="e">The <see cref="SessionSwitchEventArgs"/> instance containing the event data.</param>
 private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         Messenger.Instance.Notify(MessengerMessage.LockApplication);
     }
 }
コード例 #2
0
    // Перехват логофа/логина
    private static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
    {
        if (e.Reason == SessionSwitchReason.SessionLock)
        {
            myTimer.Stop();
            C_LogOff++;
            TimeLogOff    = DateTime.Now;
            AllTimeLogIn += (TimeLogOff - TimeStartAct);

            LogWrite("I left! Activity: "
                     + (TimeLogOff - TimeStartAct).ToString(@"hh\:mm\:ss")
                     + " - all: "
                     + AllTimeLogIn.ToString(@"hh\:mm\:ss"));
        }
        else if (e.Reason == SessionSwitchReason.SessionUnlock)
        {
            C_LogIn++;
            AllTimeLogOff += (DateTime.Now - TimeLogOff);

            LogWrite("I returned! Stop: "
                     + (DateTime.Now - TimeLogOff).ToString(@"hh\:mm\:ss")
                     + " - all: "
                     + AllTimeLogOff.ToString(@"hh\:mm\:ss"));

            Start();
        }
    }
コード例 #3
0
ファイル: App.xaml.cs プロジェクト: suryaprakashs/blues
        private void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            if (e.Reason == SessionSwitchReason.SessionLock)
            {
                backgroundManager.StopUnlockTimer();
                int OrderNo = commonService.InfoViewModel.SystemActions.First().OrderNo + 1;

                var sysAction = new SystemAction {
                    OrderNo = OrderNo, CurrentAction = ActionType.Lock, ActionTime = DateTime.Now
                };
                commonService.InfoViewModel.SystemActions.Insert(0, sysAction);

                backgroundManager.SaveSystemAction(sysAction);
            }
            else if (e.Reason == SessionSwitchReason.SessionUnlock)
            {
                backgroundManager.StartUnlockTimer();
                int OrderNo = commonService.InfoViewModel.SystemActions.First().OrderNo + 1;

                var sysAction = new SystemAction {
                    OrderNo = OrderNo, CurrentAction = ActionType.Unlock, ActionTime = DateTime.Now
                };
                commonService.InfoViewModel.SystemActions.Insert(0, sysAction);

                backgroundManager.SaveSystemAction(sysAction);
            }
        }
コード例 #4
0
 private void OnSessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
         StartAwayPeriod();
     if (e.Reason == SessionSwitchReason.SessionUnlock)
         EndAwayPeriod();
 }
コード例 #5
0
ファイル: Program.cs プロジェクト: EvelynSubarrow/RummeryKOTH
 static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         //Process.Start("shutdown", "/f /s /t 0");
     }
 }
コード例 #6
0
 private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     try
     {
         if (e.Reason == SessionSwitchReason.SessionLogoff ||
             e.Reason == SessionSwitchReason.SessionLock ||
             e.Reason == SessionSwitchReason.RemoteDisconnect)
         {
             //EventTrackerContext.Save(
             EventQueue.Enqueue(
                 new LogOnEvent()
                 {
                     IsLoggedOn = false,
                     EventTime = DateTime.Now,
                 });
         }
         else
         {
             //EventTrackerContext.Save(
             EventQueue.Enqueue(
                 new LogOnEvent()
                 {
                     IsLoggedOn = true,
                     EventTime = DateTime.Now,
                 });
         }
     }
     catch (Exception ex)
     {
         Logger.Log(ex.ToString());
     }
 }
コード例 #7
0
		public void Constructor ()
		{
			foreach (SessionSwitchReason ssr in Enum.GetValues (typeof (SessionSwitchReason))) {
				SessionSwitchEventArgs ssea = new SessionSwitchEventArgs (ssr);
				Assert.AreEqual (ssr, ssea.Reason, ssr.ToString ());
			}
		}
コード例 #8
0
        void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            currentUserName = GetCurrentLoginUserName();

            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLock || e.Reason == Microsoft.Win32.SessionSwitchReason.ConsoleDisconnect)
            {
                callback("UserLock:" + currentUserName + ";");
                eloginState = eLoginState.slock;
            }
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionUnlock || e.Reason == Microsoft.Win32.SessionSwitchReason.ConsoleConnect)
            {
                callback("UserUnLock:" + currentUserName + ";");
                eloginState = eLoginState.sunlock;
            }
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLogoff)
            {
                callback("UserLogOff:" + currentUserName + ";");
                eloginState = eLoginState.slogOff;
                // msg("LogOff");
                //outRtb(ref msgRtb, "LogOff\n", true);
            }
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLogon)
            {
                callback("UserLogOn:" + currentUserName + ";");
                eloginState = eLoginState.slogOn;
                // msg("LogIn");
                //outRtb(ref msgRtb, "LogIn\n", true);
            }
        }
コード例 #9
0
        void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            string currentUserName = cWindowsIdentity.GetCurrentLoginUserName();

            List <string> lstring = new List <string>();

            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLock || e.Reason == Microsoft.Win32.SessionSwitchReason.ConsoleDisconnect)
            { // lock
                mWindowsState = sWindowsState.SessionLock;
                lstring.Add(currentUserName + " lock");
            }
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionUnlock || e.Reason == Microsoft.Win32.SessionSwitchReason.ConsoleConnect)
            { // unlock
                mWindowsState = sWindowsState.SessionUnLock;
                lstring.Add(currentUserName + " unlock");
            }
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLogoff)
            {  // logoff
                mWindowsState = sWindowsState.SessionLogoff;
                lstring.Add(currentUserName + " logOff");
            }
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLogon)
            {  // login
                mWindowsState = sWindowsState.SessionLogon;
                lstring.Add(currentUserName + " logIn");
            }
            ExportImportFile.StringArrayToFile(lstring, "log.txt", true);
        }
コード例 #10
0
ファイル: WindowsLocker.cs プロジェクト: Confirmit/Students
 void SessionSwitch(object o, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
         LockStatusChanged(this, new LockStatusChangedEventArgs(LockStatusChangedReason.Lock));
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
         LockStatusChanged(this, new LockStatusChangedEventArgs(LockStatusChangedReason.Unlock));
 }
コード例 #11
0
ファイル: Display.cs プロジェクト: t-yng/ImHere
        /* セッション切り替えイベントを監視 */
        private void WatchSessionSwitchEvent(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            // ユーザーがセッションをロック
            if (e.Reason == SessionSwitchReason.SessionLock)
            {
                //I left my desk
                Console.WriteLine("I left my desk");
                NotifyUpdateState(OUTROOM);
            }
            // ユーザーがセッションのロックを解除
            else if (e.Reason == SessionSwitchReason.SessionUnlock)
            {
                //I returned to my desk
                Console.WriteLine("I returned to my desk");

                if (isRemoteSession() == false)
                {
                    NotifyUpdateState(INROOM);
                }
            }
            // ユーザーがセッションからログオフ
            else if (e.Reason == SessionSwitchReason.SessionLogoff)
            {
                Console.WriteLine("I logoff");
                NotifyUpdateState(INROOM);
            }
        }
コード例 #12
0
		public void OutOfRange ()
		{
			SessionSwitchReason ssr = (SessionSwitchReason) Int32.MinValue;
			SessionSwitchEventArgs ssea = new SessionSwitchEventArgs (ssr);
			Assert.AreEqual (ssr, ssea.Reason, "Int32.MinValue");
			// no validation is done on the enum value used
		}
コード例 #13
0
ファイル: Form.cs プロジェクト: layonez/Track-My-Work
 private void LoadGridSource(object sender, SessionSwitchEventArgs e)
 {
     var dt = DBProvider.ReadAll();
     
     Source = dt;
     dataGridView.DataSource = Source;
 }
 void SysEventsCheck(object sender, SessionSwitchEventArgs e)
 {
     switch (e.Reason)
     {
         case SessionSwitchReason.SessionLock: Console.WriteLine("Lock Encountered"); break;
         case SessionSwitchReason.SessionUnlock: Console.WriteLine("UnLock Encountered"); break;
     }
 }
コード例 #15
0
 static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         //I returned to my desk
         client.Publish(computerState, Encoding.UTF8.GetBytes("online"), MqttMsgBase.QOS_LEVEL_AT_LEAST_ONCE, true);
     }
 }
コード例 #16
0
ファイル: DeviceEvents.cs プロジェクト: jbatonnet/flowtomator
 private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     switch (e.Reason)
     {
         case SessionSwitchReason.SessionLock: OnDeviceLocked(); break;
         case SessionSwitchReason.SessionUnlock: OnDeviceUnlocked(); break;
     }
 }
コード例 #17
0
ファイル: TrackerEngine.cs プロジェクト: ohalay/SimpleTracker
 private void OnSessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     switch (e.Reason)
     {
         case SessionSwitchReason.SessionLock: StopWatch(); break;
         case SessionSwitchReason.SessionUnlock: StartWatch(); break;
         default: throw new NotSupportedException();
     }
 }
コード例 #18
0
        public void BreakPeriodStopped_ForCorrectSystemEvents(SessionSwitchReason reason)
        {
            // Act
            var sessionSwitchEventArgs = new SessionSwitchEventArgs(reason);
            _MockSystemEvents.Raise(m => m.SessionSwitch += null, null, sessionSwitchEventArgs);

            // Verify
            _MockPeriodBetweenBreaks.Verify(m => m.Stop(), Times.Once());
        }
コード例 #19
0
ファイル: frmPlayer.cs プロジェクト: bernardocervoz/player
 void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         //Keyboard.SendKey(Keys.MediaStop);
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
     }
 }
コード例 #20
0
 void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         Console.WriteLine("User left (session locked) : " + DateTime.Now.ToShortTimeString());
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         Console.WriteLine("User back (session unlocked) : " + DateTime.Now.ToShortTimeString());
     }
 }
コード例 #21
0
        /****************************************************/

        static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            if (e.Reason == SessionSwitchReason.SessionLock)
            {
                BlinkStickManager.GetInstance().SetDoNotDisturb();
            }
            else if (e.Reason == SessionSwitchReason.SessionUnlock)
            {
                BlinkStickManager.GetInstance().RestoreLastState();
            }
        }
コード例 #22
0
 //What happens when the screen locks
 static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         locked = true;
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         locked = false;
     }
 }
コード例 #23
0
 private void SystemEvents_OnSessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         Dispatcher.Invoke((Action)(() => StateManager.ChangeState(TimerState.NotWorking)));
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         // not sure what to do here, so it is better to leave NotWorking
         //StateManager.ChangeState(TimerState.NotWorking);
     }
 }
コード例 #24
0
ファイル: Form1.cs プロジェクト: dreikanter/trigger
        private static void OnSessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            switch(e.Reason)
            {
                case SessionSwitchReason.SessionUnlock:
                    OnSessionUnlock();
                    break;

                default:
                    break;
            }
        }
コード例 #25
0
 private void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         IsLocked = true;
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         IsLocked = false;
         DoFetch(); // On unlock I want to fetch the changes
     }
 }
コード例 #26
0
 private void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         DebugLog.LogInfo("Computer locked: Pausing playback");
         _mediaPlayerWrapper.Pause();
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         Console.WriteLine("Welcome back - you will need to manual start the audio.");
     }
 }
コード例 #27
0
ファイル: Sniffer.cs プロジェクト: murgo/locksniffer
        void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            if (LockReasons.Contains(e.Reason))
            {
                _lög.Lög(new LögEntry { Locked = true, Timestamp = DateTime.Now, Message = e.Reason.ToString() });
            }

            if (UnlockReasons.Contains(e.Reason))
            {
                _lög.Lög(new LögEntry { Locked = false, Timestamp = DateTime.Now, Message = e.Reason.ToString() });
            }
        }
コード例 #28
0
 void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     switch(e.Reason)
     {
         case SessionSwitchReason.SessionLock:
             if (SystemLocked != null) SystemLocked();
             break;
         case SessionSwitchReason.SessionUnlock:
             if (SystemUnlocked != null) SystemUnlocked();
             break;
     }
 }
コード例 #29
0
 private static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         //I left my desk
         ComputerLocked = true;
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         //I returned to my desk
         ComputerLocked = false;
     }
 }
コード例 #30
0
ファイル: Program.cs プロジェクト: fluxium/MoveReminder
 static void HandleSessionSwitch(System.Timers.Timer timer, object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         //I left my desk
         timer.Stop();
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         //I returned to my desk
         timer.Start();
     }
 }
コード例 #31
0
 void HandleLock(object sender, SessionSwitchEventArgs e)
 {
     switch (e.Reason)
     {
         case SessionSwitchReason.SessionLock:
             _outputService.ShowInterface();
             _eventHandler.Invoke(this);
             break;
         case SessionSwitchReason.SessionUnlock:
             _outputService.HideInterface();
             break;
     }
 }
コード例 #32
0
 static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         //I left my desk
         Console.WriteLine("I left my desk");
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         //I returned to my desk
         Console.WriteLine("I returned to my desk");
     }
 }
コード例 #33
0
        static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            MainForm form = (MainForm)Application.OpenForms[0];

            if (e.Reason == SessionSwitchReason.SessionLock)
            {
                form.HandleSessionLock();
            }
            else if (e.Reason == SessionSwitchReason.SessionUnlock)
            {
                form.HandleSessionUnlock();
            }
        }
コード例 #34
0
 void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         LogTrace.WriteInfoLog(string.Format("locked"));
         cron_daemon.Stop();
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         LogTrace.WriteInfoLog(string.Format("unlocked"));
         cron_daemon.Start();
     }
 }
コード例 #35
0
ファイル: Program.cs プロジェクト: AmitToren/SnitchathonFFS
        static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            WindowsIdentity winId = WindowsIdentity.GetCurrent();

            if (e.Reason == SessionSwitchReason.SessionLock)
            {
                Console.WriteLine("User is locked");
            }
            else if (e.Reason == SessionSwitchReason.SessionUnlock)
            {
                Console.WriteLine("User is logged");
            }
        }
コード例 #36
0
 protected void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         OnDeactivated(sender, e);
         locked = true;
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         OnActivated(sender, e);
         locked = false;
     }
 }
コード例 #37
0
        /// <summary>
        /// 监控屏幕锁定与解锁
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLock)
            {
                // 屏幕锁定
                FileOperations.End();
            }

            else if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionUnlock)
            {
                // 屏幕解锁
                FileOperations.Start();
            }
        }
コード例 #38
0
 void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         destroy();
         Console.WriteLine("Locked");
         //I left my desk
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         Console.WriteLine("Unlocked");
         //I returned to my desk
     }
 }
コード例 #39
0
        /// <summary>
        /// 监控屏幕锁定与解锁
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionLock)
            {
                // 屏幕锁定
                End();
            }

            else if (e.Reason == Microsoft.Win32.SessionSwitchReason.SessionUnlock)
            {
                // 屏幕解锁
                Start();
            }
        }
コード例 #40
0
        static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            MainForm mainForm = (MainForm)Application.OpenForms[0];

            if (mainForm.settings.PauseActiveTimer && e.Reason == SessionSwitchReason.SessionLock)
            {
                foreach (var issue in mainForm.issueControls)
                {
                    issue.Pause();
                }
            }
            else if (e.Reason == SessionSwitchReason.SessionUnlock)
            {
                //I returned to my desk
            }
        }
コード例 #41
0
ファイル: timer.cs プロジェクト: sanglyb/logon-logoff
 void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock || e.Reason == SessionSwitchReason.SessionLogoff || e.Reason == SessionSwitchReason.ConsoleDisconnect || e.Reason == SessionSwitchReason.RemoteDisconnect)
     {
         System.Threading.Thread.Sleep(1500);
         first = 0;
         string type = "logoff";
         string sql  = "exec insert_into_dbuserlogin @username='******', ";
         sql += "@computername ='" + Program.computername + "', @type='" + type + "', @is_rdp=" + Program.rdp_check() + ", @first=0;";
         timer1.Stop();
         timer2.Stop();
         Program.sql_execute(sql);
         Program.log_write("Программа logon_agent завершила работу", EventLogEntryType.Information);
         this.Close();
     }
 }
コード例 #42
0
 /// <summary>
 /// 检测PC是否被锁屏和是否进入RDP锁屏界面
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock || e.Reason == SessionSwitchReason.RemoteConnect)
     {
         //I left my desk
         //Console.WriteLine("lock");
         info.MyInfo.IsSreenLock = true;
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock || e.Reason == SessionSwitchReason.ConsoleConnect)
     {
         //I returned to my desk
         info.MyInfo.IsSreenLock = false;
         //Console.WriteLine(DateTime.Now);
         //Console.WriteLine("Unlock");
     }
 }
コード例 #43
0
ファイル: SessionSwitch.cs プロジェクト: PaulWild/TrackMyDay
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     switch (e.Reason)
     {
         case SessionSwitchReason.SessionUnlock:
         case SessionSwitchReason.SessionLogon:
         case SessionSwitchReason.RemoteConnect:
             SessionSwitched?.Invoke(this, new SessionSwitchedArgs(true, e.Reason));
             break;
         case SessionSwitchReason.ConsoleDisconnect:
         case SessionSwitchReason.RemoteDisconnect:
         case SessionSwitchReason.SessionLogoff:
         case SessionSwitchReason.SessionLock:
             SessionSwitched?.Invoke(this, new SessionSwitchedArgs(false, e.Reason));
             break;
     }
 }
コード例 #44
0
ファイル: TrackEvents.cs プロジェクト: PaulWild/TrackMyDay
        private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            if (e.Reason == SessionSwitchReason.SessionUnlock
                || e.Reason == SessionSwitchReason.SessionLogon
                || e.Reason == SessionSwitchReason.RemoteConnect)
            {
                var dr = MessageBox.Show("Are You At Work?", "Track My Day", MessageBoxButtons.YesNo);

                // TODO Record Logon
            }
            else if (e.Reason == SessionSwitchReason.ConsoleDisconnect
                     || e.Reason == SessionSwitchReason.RemoteDisconnect
                     || e.Reason == SessionSwitchReason.SessionLogoff)
            {
                // TODO Record Close
            }
        }
コード例 #45
0
        private static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            if (!Running)
            {
                return;
            }
            switch (e.Reason)
            {
            case SessionSwitchReason.ConsoleConnect:
            case SessionSwitchReason.RemoteConnect:
            case SessionSwitchReason.SessionUnlock:
                userLoggedOn();
                break;

            default:
                userLoggedOff();
                break;
            }
        }
コード例 #46
0
 void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         if (StartOfLastActivity.HasValue)
         {
             ActiveTime += (DateTime.Now - StartOfLastActivity.Value);
         }
         TextBoxLog.Text    += DateTime.Now + " PAUSE" + Environment.NewLine;
         StartOfLastPause    = DateTime.Now;
         StartOfLastActivity = null;
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         TextBoxLog.Text    += DateTime.Now + " RESUME" + Environment.NewLine;
         StartOfLastPause    = null;
         StartOfLastActivity = DateTime.Now;
     }
 }
コード例 #47
0
 /// <summary>
 /// screenlock tail
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         //I left my desk
         ssTimer.Stop();
         ssFlg = true;
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         //I returned to my desk
         ssTimer.Start();
         ssFlg = false;
         if (tipStack.Count != 0)
         {
             DisplayStackBalloon(tipStack);
         }
     }
 }
コード例 #48
0
        void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
        {
            switch (e.Reason)
            {
            case SessionSwitchReason.SessionLock:
                _bIsSessionLocked = true;
                logger.Debug("Pause because of SessionSwitchReason.SessionLock event");
                _soOrchestrator.Pause();
                break;

            case SessionSwitchReason.SessionUnlock:
                _bIsSessionLocked = false;
                logger.Debug("Resume because of SessionSwitchReason.SessionUnlock event");
                _soOrchestrator.Resume();
                break;

            default:
                break;
            }
        }
コード例 #49
0
ファイル: AdminWindow.xaml.cs プロジェクト: sumeetjauhar/YQ
        void SysEventsCheck(object sender, SessionSwitchEventArgs e)
        {

            try
            {
                switch (e.Reason) 
                {

                    case SessionSwitchReason.SessionUnlock:
                        log.dispatchLogMessage("System has been UNLOCKED !  Re-initiating connection to a PROTAG device ! ");
                        InitializeComponent();
                        if (startBluetooth == 2)
                        {
                            bgBluetooth = new BackgroundWorker();
                            bgBluetooth.DoWork += new DoWorkEventHandler(bg_DoBluetoothWork);
                            bgBluetooth.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bg_RunBluetoothThreadCompleted);
                            if (!bgBluetooth.IsBusy)
                            {

                                bgBluetooth.RunWorkerAsync();
                            }
                        }
                        if (startWireless == 2)
                        {
                            /*
                             * Sleep for 20 seconds . 
                             */
                            System.Threading.Thread.Sleep(20000);
                            checkCurrentWirelessCon();
                            registerWlanListener();
                        }
                        break;
                }
            }
            catch (Exception ex)
            {
                log.dispatchLogMessage("MainServices: SystemEventsCheck" + ex.ToString());
                

            }
        }
コード例 #50
0
ファイル: TrayIconForm.cs プロジェクト: pbalint/Playground
 private void SessionSwitch( object sender, SessionSwitchEventArgs e )
 {
     bool refresh = false;
     switch ( e.Reason )
     {
         case SessionSwitchReason.SessionLogon:
         case SessionSwitchReason.SessionUnlock:
             events.Add( new EventEntry( DateTime.Now, SessionSwitchReason.SessionLogon ) );
             refresh = true;
             break;
         case SessionSwitchReason.SessionLogoff:
         case SessionSwitchReason.SessionLock:
             events.Add( new EventEntry( DateTime.Now, SessionSwitchReason.SessionLogoff ) );
             refresh = true;
             break;
     }
     if ( refresh )
     {
         Utils.Serialize( events, events_file_name );
     }
 }
コード例 #51
0
 static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e)
 {
     try
     {
         if (e.Reason == SessionSwitchReason.SessionLock)
         {
             Is_Windows_Locked = true;
             //////I left my desk
             ////loger.WriteLog("sts", "Windows Locked");
         }
         else if (e.Reason == SessionSwitchReason.SessionUnlock)
         {
             Is_Windows_Locked = false;
             ////////I returned to my desk
             //////loger.WriteLog("sts", "Windows UnLocked");
         }
     }
     catch (Exception ex)
     {
         // loger.WriteLog("err", "In SystemEvents_SessionSwitch - " + ex.Message);
     }
 }
コード例 #52
0
ファイル: FormOpenDental.cs プロジェクト: nampn/ODental
 private void SystemEvents_SessionSwitch(object sender,SessionSwitchEventArgs e)
 {
     if(e.Reason!=SessionSwitchReason.SessionLock) {
         return;
     }
     if(!PrefC.GetBool(PrefName.SecurityLogOffWithWindows)) {
         return;
     }
     if(Security.CurUser==null) {//not sure if this is a good test.
         return;
     }
     //simply copied and pasted code from logoff menu click for testing.
     LastModule=myOutlookBar.SelectedIndex;
     myOutlookBar.SelectedIndex=-1;
     myOutlookBar.Invalidate();
     UnselectActive();
     allNeutral();
     if(FormLogOn_!=null) {//To prevent multiple log on screens from showing.
         FormLogOn_.Dispose();
     }
     FormLogOn_=new FormLogOn();
     FormLogOn_.ShowDialog(this);//Passing "this" brings FormL to the front when user logs back in.
     if(FormLogOn_.DialogResult==DialogResult.Cancel) {
         Application.Exit();
         return;
     }
     myOutlookBar.SelectedIndex=Security.GetModule(LastModule);
     myOutlookBar.Invalidate();
     SetModuleSelected();
     if(CurPatNum==0) {
         Text=PatientL.GetMainTitle("",0,"",0);
     }
     else {
         Patient pat=Patients.GetPat(CurPatNum);
         Text=PatientL.GetMainTitle(pat.GetNameLF(),pat.PatNum,pat.ChartNumber,pat.SiteNum);
     }
     if(userControlTasks1.Visible) {
         userControlTasks1.InitializeOnStartup();
     }
     if(myOutlookBar.SelectedIndex==-1) {
         MsgBox.Show(this,"You do not have permission to use any modules.");
     }
 }
コード例 #53
0
ファイル: MainForm.cs プロジェクト: rlarno/DayTimer
        private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            switch (e.Reason)
            {
                case SessionSwitchReason.SessionLock:
                    _pomodoro.SessionLock();
                    break;

                case SessionSwitchReason.SessionUnlock:
                    ShowNagScreen("Unlock");
                    break;
            }
        }
コード例 #54
0
ファイル: MainStartup.cs プロジェクト: kreeturez/MediaBrowser
 static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLogon)
     {
         BrowserLauncher.OpenDashboard(_appHost.UserManager, _appHost.ServerConfigurationManager, _appHost, _logger);
     }
 }
コード例 #55
0
ファイル: Form1.cs プロジェクト: MikeS159/PCBreakTimer
 /// <summary>
 /// Called when the session switch event is triggered
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     string s = DateTime.Now.ToString();
     s = s + " " + e.Reason.ToString();
     richTextBox1.AppendText(s + "\n");
     if (e.Reason == SessionSwitchReason.SessionLogon)
     {
         Start();
     }
     if (e.Reason == SessionSwitchReason.SessionLogoff)
     {
         Stop();
     }
     if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         Unlock();
     }
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         Lock();
     }
     if (e.Reason == SessionSwitchReason.ConsoleConnect)
     {
         Unlock();
     }
     if (e.Reason == SessionSwitchReason.ConsoleDisconnect)
     {
         Lock();
     }
 }
コード例 #56
0
        private void OnSessionSwitch(object sender, SessionSwitchEventArgs e)
        {
            _log.Info("Session switched to: '{0}'", e.Reason);

            switch (e.Reason)
            {
                case SessionSwitchReason.SessionLock:
                    _inputTracker.Stop();
                    LogUserActivity(false, true, DateTime.Now);
                    break;

                case SessionSwitchReason.SessionUnlock:
                    _inputTracker.Start();
                    break;

                case SessionSwitchReason.SessionLogoff:
                    Stop();
                    break;

                case SessionSwitchReason.SessionLogon:
                    Start();
                    break;
            }
        }
コード例 #57
0
        private void SystemEventsOnSessionSwitch(object sender, SessionSwitchEventArgs sessionSwitchEventArgs)
        {
            switch (sessionSwitchEventArgs.Reason)
            {
                case SessionSwitchReason.SessionLogon:
                    //Logon
                    SendPushNotif("Notificacion de seguridad", "Su sesion de usuario ha sido iniciada.");

                    break;
                case SessionSwitchReason.SessionLogoff:
                    //Logoff
                    SendPushNotif("Notificacion de seguridad", "Su sesion de usuario ha sido cerrada.");

                    break;
                case SessionSwitchReason.RemoteConnect:
                    //Remote Connect
                    SendPushNotif("Notificacion de seguridad", "Se ha iniciado una conexion remota a su equipo.");

                    break;
                case SessionSwitchReason.RemoteDisconnect:
                    //Remote Disconnect
                    SendPushNotif("Notificacion de seguridad", "Se ha cerrado una conexion remota a su equipo.");

                    break;
                case SessionSwitchReason.SessionLock:
                    //lock
                    SendPushNotif("Notificacion de seguridad", "Su equipo ha sido bloqueado.");

                    break;
                case SessionSwitchReason.SessionUnlock:
                    //Unlock
                    SendPushNotif("Notificacion de seguridad", "Su equipo ha sido desbloqueado.");

                    break;
            }
        }
コード例 #58
0
 private static void SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLock)
     {
         _wasPlaying = IsSpotifyPlaying();
         SetSpotifyState(false);
     }
     else if (e.Reason == SessionSwitchReason.SessionUnlock)
     {
         SetSpotifyState(_wasPlaying);
     }
 }
コード例 #59
0
 /// <summary>
 /// Event handler for session switching. Used for handling locking and unlocking of the system
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     switch(e.Reason) {
         case SessionSwitchReason.SessionLogoff:
         case SessionSwitchReason.SessionLock:
             NewGlowCmdAvailEvent(new PowerOffCommand(-1));//turn all off
             break;
         case SessionSwitchReason.SessionLogon:
         case SessionSwitchReason.SessionUnlock:
             Thread.Sleep(2500);//wait for system to be ready
             SendStartCommand(-1);//start all
             break;
     }
 }
コード例 #60
0
ファイル: MainStartup.cs プロジェクト: t-andre/Emby
 static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
 {
     if (e.Reason == SessionSwitchReason.SessionLogon)
     {
         BrowserLauncher.OpenDashboard(_appHost);
     }
 }