Пример #1
0
        /// <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;
        }
Пример #2
0
        public void DatabaseConnectionTest()
        {
            DatabaseConnection.Initialize(@"SERVER\SQLEXPRESS", "Domotica", "kaku", "kaku");

              Assert.IsTrue(DatabaseConnection.IsInitialized, "DatabaseConnection is niet geïnitialiseerd.");
              DeviceViewCollection devCol = new DeviceViewCollection();
              devCol.GetAll();
              Assert.IsTrue(devCol.Count > 0, "Er zijn geen devices gevonden.");

              ProgramCollection progCol = new ProgramCollection();
              progCol.GetAll();
              Assert.IsTrue(progCol.Count > 0, "Er zijn geen programs gevonden.");
        }
Пример #3
0
 void DeviceHelper_UpdateDevices(DeviceViewCollection devices)
 {
     Statics.DeviceViewCollection = devices;
 }
Пример #4
0
 public static void InitializeAsClient(DeviceViewCollection deviceCollection)
 {
     _isServerContext = false;
       isInitialized = DatabaseConnection.IsInitialized;
 }