public static void Run() { Console.WriteLine("Please press any key to Start Locking..."); Console.ReadKey(true); MonitorMessageNotifier notifier = MonitorMessageNotifier.getInstance(); notifier.MonitorLocked += new EventHandler <MonitorEventArgs>(notifier_MonitorLocked); notifier.MonitorUnlocked += new EventHandler <MonitorEventArgs>(notifier_MonitorUnlocked); notifier.MonitorShutdown += new EventHandler <MonitorEventArgs>(notifier_MonitorShutdown); notifier.MonitorOpened += new EventHandler <MonitorEventArgs>(notifier_MonitorOpened); notifier.Start(); log.Info("Started Listening!"); Thread.Sleep(1000 * 60); log.Debug("************60 seconds"); //MonitorController.TurnOff(); //Thread.Sleep(2000); //MonitorController.TurnOn(); Thread.Sleep(1000 * 20); notifier.Stop(); log.Info("Stopped Listening!"); }
private void MonitorServiceForm_FormClosed(object sender, FormClosedEventArgs e) { MonitorNotifier.Stop(); }