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 btnIdle_Click(object sender, EventArgs e) { var idleTimerWindow = new IdleTimerWindow(gallifrey); if (idleTimerWindow.DisplayForm) { idleTimerWindow.ShowDialog(); RefreshTimerPages(); } }