Esempio n. 1
0
        /// <summary>
        /// Stops the serial port monitor.
        /// </summary>
        private void StopSerialPortMonitor()
        {
            DebugOutput("IOService: StopSerialPortMonitor");
            var systemPowerManagement = PortNotifier as ISystemPowerManagement;

            if (systemPowerManagement != null)
            {
                systemPowerManagement.SystemDidPowerOn   -= HandleSystemDidPowerOn;
                systemPowerManagement.SystemWillPowerOff -= HandleSystemWillPowerOff;
                systemPowerManagement.SystemWillSleep    -= HandleSystemWillSleep;
            }
            PortNotifier.Stop();
            PortNotifier = null;
        }
Esempio n. 2
0
        /// <summary>
        /// Starts the serial port monitor.
        /// </summary>
        private void StartSerialPortMonitor()
        {
            DebugOutput("IOService: StartSerialPortMonitor");
            PortNotifier = CreatePortNotifier();
            var systemPowerManagement = PortNotifier as ISystemPowerManagement;

            if (systemPowerManagement != null)
            {
                systemPowerManagement.SystemWillSleep    += HandleSystemWillSleep;
                systemPowerManagement.SystemWillPowerOff += HandleSystemWillPowerOff;
                systemPowerManagement.SystemDidPowerOn   += HandleSystemDidPowerOn;
            }
            PortNotifier.Start();
        }
Esempio n. 3
0
        private void RunUI()
        {
            try
            {
                // Init stuff

                // Need to do this from the same thread as Application.Run() will run from...
                PortNotifier.Init();

                mNotifyIcon = new UI.NotifyIcon(Properties.Resources.NotifyIcon);

                // FIXME - NOT thread safe
                updateNotificationStatus();

                Application.Run(mApplicationContext);

                // Signal quit
                mRunning = false;
            }
            catch (Exception e)
            {
                Logging.Log.Exception(e);
            }
        }
Esempio n. 4
0
 private void PortAdded(object sender, PortNotifier.PortAddedEventArgs args)
 {
     if (args.Port == mPort && !IsConnected)
     {
         // Trigger a retry to connect to the port
         mPortEvent.Set();
     }
 }