/// <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); } }
// Перехват логофа/логина 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(); } }
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); } }
private void OnSessionSwitch(object sender, SessionSwitchEventArgs e) { if (e.Reason == SessionSwitchReason.SessionLock) StartAwayPeriod(); if (e.Reason == SessionSwitchReason.SessionUnlock) EndAwayPeriod(); }
static void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e) { if (e.Reason == SessionSwitchReason.SessionLock) { //Process.Start("shutdown", "/f /s /t 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()); } }
public void Constructor () { foreach (SessionSwitchReason ssr in Enum.GetValues (typeof (SessionSwitchReason))) { SessionSwitchEventArgs ssea = new SessionSwitchEventArgs (ssr); Assert.AreEqual (ssr, ssea.Reason, ssr.ToString ()); } }
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); } }
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); }
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)); }
/* セッション切り替えイベントを監視 */ 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); } }
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 }
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; } }
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); } }
private static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) { switch (e.Reason) { case SessionSwitchReason.SessionLock: OnDeviceLocked(); break; case SessionSwitchReason.SessionUnlock: OnDeviceUnlocked(); break; } }
private void OnSessionSwitch(object sender, SessionSwitchEventArgs e) { switch (e.Reason) { case SessionSwitchReason.SessionLock: StopWatch(); break; case SessionSwitchReason.SessionUnlock: StartWatch(); break; default: throw new NotSupportedException(); } }
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()); }
void SystemEvents_SessionSwitch(object sender, Microsoft.Win32.SessionSwitchEventArgs e) { if (e.Reason == SessionSwitchReason.SessionLock) { //Keyboard.SendKey(Keys.MediaStop); } else if (e.Reason == SessionSwitchReason.SessionUnlock) { } }
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()); } }
/****************************************************/ 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(); } }
//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; } }
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); } }
private static void OnSessionSwitch(object sender, SessionSwitchEventArgs e) { switch(e.Reason) { case SessionSwitchReason.SessionUnlock: OnSessionUnlock(); break; default: break; } }
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 } }
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."); } }
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() }); } }
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; } }
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; } }
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(); } }
void HandleLock(object sender, SessionSwitchEventArgs e) { switch (e.Reason) { case SessionSwitchReason.SessionLock: _outputService.ShowInterface(); _eventHandler.Invoke(this); break; case SessionSwitchReason.SessionUnlock: _outputService.HideInterface(); break; } }
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"); } }
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(); } }
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(); } }
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"); } }
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; } }
/// <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(); } }
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 } }
/// <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(); } }
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 } }
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(); } }
/// <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"); } }
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; } }
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 } }
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; } }
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; } }
/// <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); } } }
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; } }
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()); } }
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 ); } }
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); } }
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."); } }
private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) { switch (e.Reason) { case SessionSwitchReason.SessionLock: _pomodoro.SessionLock(); break; case SessionSwitchReason.SessionUnlock: ShowNagScreen("Unlock"); break; } }
static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) { if (e.Reason == SessionSwitchReason.SessionLogon) { BrowserLauncher.OpenDashboard(_appHost.UserManager, _appHost.ServerConfigurationManager, _appHost, _logger); } }
/// <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(); } }
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; } }
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; } }
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); } }
/// <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; } }
static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e) { if (e.Reason == SessionSwitchReason.SessionLogon) { BrowserLauncher.OpenDashboard(_appHost); } }