Пример #1
0
        public void submitLightRequest(Light light)
        {
            this.light = light;
            LightForm form = new LightForm(this);

            form.ShowDialog();
        }
Пример #2
0
        public void executeRequest(LightRequest request)
        {
            if (request.BrightnessValue < 0)
            {
                if (displayConfirmation("Error: Brightness must be a positive integer."))
                {
                    LightForm form = new LightForm(this);
                    form.ShowDialog();
                }
                return;
            }

            if (request.BrightnessValue == 0)
            {
                light.Status     = false;
                light.OnTime     = request.OnTime;
                light.OffTime    = request.OffTime;
                light.Brightness = 0;
            }
            else
            {
                light.Status     = true;
                light.OnTime     = request.OnTime;
                light.OffTime    = request.OffTime;
                light.Brightness = request.BrightnessValue;
            }

            displayConfirmation("Light successfuly changed.");
        }
Пример #3
0
        public LightController(Light light)
        {
            this.light = light;
            LightForm form = new LightForm(this);

            form.ShowDialog();
        }
Пример #4
0
        private void ShowLightForm()
        {
            LightForm lightForm = new LightForm(this.light);

            lightForm.ShowDialog(this);
        }