public void InitializeLightingDevices(LightDeviceSettings deviceSettings)
        {
            _lightDevices = new Dictionary <int, LightingBase>(100);

            foreach (LightingDeviceInformation device in deviceSettings.devices)
            {
                Assembly myAssembly = Assembly.LoadFrom(@"Crestron.SimplSharpPro.Lighting.dll");

                CType myType = myAssembly.GetType("Crestron.SimplSharpPro.Lighting." + device.type);

                var rfid      = SettingsManager.ConvertStringNumberToInt(device.rfid);
                var gatewayId = SettingsManager.ConvertStringNumberToInt(device.gateway);
                var id        = SettingsManager.ConvertStringNumberToInt(device.id);

                ConstructorInfo ctor = myType.GetConstructor(new CType[] { typeof(UInt32), typeof(GatewayBase) });

                GatewayBase gateway;


                if (_gateways.TryGetValue(gatewayId, out gateway))
                {
                    object myInstance = ctor.Invoke(new object[] { (UInt32)rfid, gateway });

                    _lightDevices.Add(id, (LightingBase)myInstance);
                }
                else
                {
                    CrestronConsole.PrintLine("Gateway not found with id of: " + device.gateway);
                }
            }
        }
        public void ParseConfigFile()
        {
            var device = _settingsManager.ReadSettingsFile(@"\NVRAM\Settings\HE_Devices.dat");

            _deviceSettings = _settingsManager.GetDeviceConfiguration(device);

            var system = _settingsManager.ReadSettingsFile(@"\NVRAM\Settings\HE_Lighting.dat");

            _systemSettings = _settingsManager.GetLightSystemConfiguration(system);
        }
        public void InitializeGateways(LightDeviceSettings deviceSettings)
        {
            _gateways = new Dictionary <int, GatewayBase>(10);

            foreach (GatewayDeviceInformation gateway in deviceSettings.gateways)
            {
                Assembly myAssembly = Assembly.LoadFrom(@"Crestron.SimplSharpPro.Gateways.dll");

                CType myType = myAssembly.GetType("Crestron.SimplSharpPro.Gateways." + gateway.type);

                var ipid = SettingsManager.ConvertStringNumberToInt(gateway.ipid);
                var id   = SettingsManager.ConvertStringNumberToInt(gateway.id);

                ConstructorInfo ctor       = myType.GetConstructor(new CType[] { typeof(UInt32), typeof(ControlSystem) });
                object          myInstance = ctor.Invoke(new object[] { (UInt32)ipid, this._system });

                _gateways.Add(id, (GatewayBase)myInstance);
            }
        }
        public void InitializeTouchPanels(LightDeviceSettings deviceSettings)
        {
            foreach (TouchPanelDeviceInformation touchpanel in deviceSettings.touchpanels)
            {
                Assembly myAssembly = Assembly.LoadFrom(@"Crestron.SimplSharpPro.EthernetCommunications.dll");

                CType myType = myAssembly.GetType("Crestron.SimplSharpPro.EthernetCommunication." + touchpanel.type);

                var ipid = SettingsManager.ConvertStringNumberToInt(touchpanel.ipid);
                var id   = SettingsManager.ConvertStringNumberToInt(touchpanel.id);

                ConstructorInfo ctor       = myType.GetConstructor(new CType[] { typeof(UInt32), typeof(string), typeof(ControlSystem) });
                object          myInstance = ctor.Invoke(new object[] { (UInt32)ipid, "127.0.0.2", this._system });

                var touchPanelView = new TouchPanelView((BasicTriList)myInstance);
                var touchPanel1    = new TouchPanelPresenter(touchPanelView, _roomManager, _sceneManager);

                _touchPanelManager.AddTouchPanel(touchPanel1);
            }
        }
 public void InitializeDevices(LightDeviceSettings deviceSettings)
 {
     InitializeGateways(deviceSettings);
     InitializeLightingDevices(deviceSettings);
     InitializeTouchPanels(deviceSettings);
 }