private void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
{
switch (e.Reason)
{
case SessionSwitchReason.SessionLock:
case SessionSwitchReason.SessionLogoff:
case SessionSwitchReason.RemoteDisconnect:
case SessionSwitchReason.ConsoleDisconnect:
// Lock the 2FA data when the machine is locked
for (int i = 0; i < settings.Accounts.Count * 3; i++)
{
contextMenu.Items.RemoveAt(0);
}
settings.Lock();
TimeoutMenuItems.Clear();
tmrMain.Enabled = false;
mnuLockUnlock.Visible = true;
mnuAddAccount.Enabled = false;
break;
}
}