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() }); } }
private void OnApplicationExit(object sender, EventArgs e) { _lög.Lög(new LögEntry { Locked = true, Message = "Service stopped", Timestamp = DateTime.Now }); _sniffer.StopSniffing(); _trayIcon.Visible = false; }
public SnifferAppContext() { Application.ApplicationExit += OnApplicationExit; InitializeComponent(); _trayIcon.Visible = true; _lög = new Lögger(); _sniffer = new Sniffer(_lög); _lög.Lög(new LögEntry { Locked = false, Message = "Service started", Timestamp = DateTime.Now }); _sniffer.StartSniffing(); }