/// <summary>
        /// 
        /// </summary>
        /// <param name="databaseConnection"></param>
        /// <param name="deviceCollection"></param>
        public static void InitializeAsServer(DeviceViewCollection deviceCollection)
        {
            RF.PoweredOn += new RF.DevicePowerDelegate(RF_PoweredOn);
              RF.PoweredOff += new RF.DevicePowerDelegate(RF_PoweredOff);
              RF.OnPowerError += new RF.DevicePowerErrorDelegate(RF_OnPowerError);

              _cm11 = new Cm11();
              _cm11.Close();
              _cm11.Notification += new Cm11LowLevelNotificationEventDelegate(_cm11_Notification);
              _cm11.OffReceived += new Cm11DeviceNotificationEventDelegate(_cm11_OffReceived);
              _cm11.OnReceived += new Cm11DeviceNotificationEventDelegate(_cm11_OnReceived);
              _cm11.LogMessage += new Cm11LogMessageEventDelegate(_cm11_LogMessage);
              _cm11.DimReceived += new Cm11BrightenOrDimNotificationEventDelegate(_cm11_DimReceived);
              _cm11.BrightenReceived += new Cm11BrightenOrDimNotificationEventDelegate(_cm11_BrightenReceived);
              _cm11.IdleStateChange += new Cm11IdleStateChangeEventDelegate(_cm11_IdleStateChange);

              try
              {
            if (!_cm11.IsOpen)
              _cm11.Open("COM4");
              }
              catch (Exception ex)
              {
            new Log(LogType.Error, LogAction.Exception, "Can't connect to CM11 device, because: " + ex.ToString());
              }

              _isServerContext = true;

              isInitialized = DatabaseConnection.IsInitialized;
        }
 public static void Dispose()
 {
     if (_cm11 != null)
       {
     _cm11.Close();
     _cm11 = null;
       }
 }