private OptecFocuser()
        {
            // First set the desired trace level.
            RefreshDone = true;
            EventLogger.LoggingLevel = XMLSettings.LoggerTraceLevel;
            EventLogger.LogMessage("Creating Instance of Optec Focuser", TraceLevel.Info);
            connectionState = ConnectionStates.Disconnected;
            mySerialCommunicator = SerialCommunicator.Instance;

            //RefreshTimer.Interval = SERIAL_MODE_REFRESH_DELAY;
            // RefreshTimer. = false;
            //RefreshTimer.Tick += new EventHandler(RefreshTimer_Elapsed);
            RefreshBGWorker.WorkerSupportsCancellation = true;
            RefreshBGWorker.DoWork += new DoWorkEventHandler(RefreshBGWorker_DoWork);
            RefreshBGWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(RefreshBGWorker_RunWorkerCompleted);

            // Get the settings stored in the xml file.
            this.displayBrightness = XMLSettings.DisplayBrightness;
            this.tempCompMode = XMLSettings.TempCompMode;
            this.temperatureOffsetC = XMLSettings.TemperatureOffsetC;
            this.displayPositionUnits = XMLSettings.DisplayPositionUnits;
            this.displayTempUnits = XMLSettings.DisplayTempUnits;
            this.autoADelay = XMLSettings.AutoADelay;
            this.autoBDelay = XMLSettings.AutoBDelay;
            this.savedSerialPortName = XMLSettings.SavedSerialPortName;
            try
            {
                mySerialCommunicator.PortName = savedSerialPortName;
            }
            catch (Exception ex)
            {
                EventLogger.LogMessage(ex);
            }
        }
 private void DoRefresh()
 {
     mySerialCommunicator = SerialCommunicator.Instance;
     if (connectionState == ConnectionStates.SerialMode)
     {
         RefreshDeviceStatus();
     }
     else if (connectionState == ConnectionStates.TempCompMode)
     {
         RefreshDeviceStatusAutoMode();
     }
 }