Exemplo n.º 1
0
        public RunningControl()
        {
            Settings.Default.PropertyChanged += new PropertyChangedEventHandler(
                delegate(object sender, PropertyChangedEventArgs e) {
                RefreshSettings();
            }
                );
            this.RunningTimer          = new System.Windows.Forms.Timer();
            this.RunningTimer.Interval = 1000;
            this.RunningTimer.Tick    += new System.EventHandler(this.runningTimer_Tick);

            monitor = MonitorMessageNotifier.getInstance();
            monitor.MonitorLocked   += new EventHandler <MonitorEventArgs>(monitor_MonitorLocked);
            monitor.MonitorUnlocked += new EventHandler <MonitorEventArgs>(monitor_MonitorUnlocked);
            monitor.Start();



            RefreshSettings();
            CompleteBreaking();
        }
Exemplo n.º 2
0
        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!");
        }