Exemplo n.º 1
0
        private void Initialize(BasicTriListWithSmartObject[] devices, uint controlJoinId)
        {
            if (_devices == null)
            {
                ControlJoinId = controlJoinId;

                _devices = new List <BasicTriListWithSmartObject>();

                ComponentMediator.Instance.ConfigureBooleanEvent(controlJoinId, Joins.Booleans.Scene_0, onScene_0);
                ComponentMediator.Instance.ConfigureBooleanEvent(controlJoinId, Joins.Booleans.Scene_1, onScene_1);
                ComponentMediator.Instance.ConfigureBooleanEvent(controlJoinId, Joins.Booleans.Scene_2, onScene_2);
                ComponentMediator.Instance.ConfigureBooleanEvent(controlJoinId, Joins.Booleans.Scene_3, onScene_3);
                ComponentMediator.Instance.ConfigureBooleanEvent(controlJoinId, Joins.Booleans.Scene_4, onScene_4);
                ComponentMediator.Instance.ConfigureNumericEvent(controlJoinId, Joins.Numerics.SelectedDimmerIndex, onSelectedDimmerIndex);

                List <uint> dimmableLoadList = _dimmableLoadSmartObjectIdMappings[controlJoinId];
                DimmableLoad = new IDimmableLoad[dimmableLoadList.Count];
                for (int index = 0; index < dimmableLoadList.Count; index++)
                {
                    DimmableLoad[index] = new DimmableLoad(devices, dimmableLoadList[index]);
                }

                ConfigureSmartObjectHandler(devices);
            }
        }
Exemplo n.º 2
0
        public DemoLightingLogic(ILightingList allSystemLights)
        {
            var lights = GetLightLoads();

            allSystemLights.Scene_0 += LightingScene_AllOn;
            allSystemLights.Scene_1 += LightingScene_AllOff;
            allSystemLights.Scene_2 += LightingScene_AllHigh;
            allSystemLights.Scene_3 += LightingScene_AllMedium;
            allSystemLights.Scene_4 += LightingScene_AllLow;

            for (int i = 0; i < allSystemLights.DimmableLoad.Length; i++)
            {
                allSystemLights.DimmableLoad[i].UserObject = lights[i];
                lights[0].UserSpecifiedObject = allSystemLights.DimmableLoad[i];

                IDimmableLoad lightingload = allSystemLights.DimmableLoad[i];

                lightingload.On    += Light_On;
                lightingload.Off   += Light_Off;
                lightingload.Level += Light_Level;
            }

            _allLights = allSystemLights;
        }