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); }
private void button1_Click(object sender, EventArgs e) { string currentUserName = cWindowsIdentity.GetCurrentLoginUserName(); List <string> lstring = new List <string>(); lstring.Add(currentUserName); ExportImportFile.StringArrayToFile(lstring, "log.txt", true); }
public MainForm() { InitializeComponent(); wIdentity = new cWindowsIdentity(); this.WindowState = FormWindowState.Maximized; this.ShowInTaskbar = false; Bitmap bm = new Bitmap("jabil.png"); pictureBox1.Image = bm; Bitmap channel1Passbm = new Bitmap("channel1Pass.png"); Bitmap channel1Failbm = new Bitmap("channel1Fail.png"); Bitmap channel1Disablebm = new Bitmap("channel1Disable.png"); resultChannelOnePictureBox.Image = channel1Passbm; Bitmap channel2Passbm = new Bitmap("channel2Pass.png"); Bitmap channel2Failbm = new Bitmap("channel2Fail.png"); Bitmap channel2Disablebm = new Bitmap("channel2Disable.png"); resultChannelTwoPictureBox.Image = channel2Disablebm; msgRtb.Text = "Test 123"; wristStrapNotify.BalloonTipClosed += wristStrapNotify_BalloonTipClosed; wristStrapNotify.BalloonTipShown += wristStrapNotify_BalloonTipShown; wristStrapNotify.BalloonTipText = "Starting"; wristStrapNotify.BalloonTipTitle = "WristStrap Monitoring"; List <string> lstring = new List <string>(); lstring.Add("init"); ExportImportFile.StringArrayToFile(lstring, "log.txt", true); }