Пример #1
0
        public Control CreateControl(Device device, List <Device> devicesList)
        {
            List <Channel> channels = Manager.GetChannelList();
            List <Device>  devices  = devicesList;
            DeviceControl  baseCtr;
            IDeviceControl deviceControl;

            if (device is ILightable)
            {
                deviceControl = new ILightableControl(device);

                baseCtr = new DeviceControl(device, devices, deviceControl, Manager);
            }

            else if (device is ITemperature)
            {
                deviceControl = new ITemperatureControl(device);

                baseCtr = new DeviceControl(device, devices, deviceControl, Manager);
            }

            else if ((device is IVoluable) && (device is IChannelable))
            {
                IVoluableControl    voluableControl    = new IVoluableControl(device);
                IChannelableControl channelableControl = new IChannelableControl(channels, device);

                deviceControl = new ITVControl(voluableControl, channelableControl);

                baseCtr = new DeviceControl(device, devices, deviceControl, Manager);
            }

            else
            {
                baseCtr = new DeviceControl();
            }

            return(baseCtr);
        }
Пример #2
0
        public Control CreateControl(Device device, List <Device> devicesList)
        {
            List <Channel> channels = Manager.GetChannelList();
            List <Device>  devices  = devicesList;
            Control        CTR      = new Control();

            if (device is ILightable)
            {
                CTR = new ILightableControl(device, devicesList, Manager);
            }

            if (device is ITemperature)
            {
                CTR = new ITemperatureControl(device, devicesList, Manager);
            }

            if (device is ITV)
            {
                CTR = new TVControl(device, devicesList, channels, Manager);
            }

            return(CTR);
        }
 public static void Provide(ITemperatureControl tempControl)
 {
     temperatureControl = tempControl;
 }