Beispiel #1
0
        public void submitLightRequest(Light light)
        {
            this.light = light;
            LightForm form = new LightForm(this);

            form.ShowDialog();
        }
Beispiel #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.");
        }
Beispiel #3
0
        public LightController(Light light)
        {
            this.light = light;
            LightForm form = new LightForm(this);

            form.ShowDialog();
        }
Beispiel #4
0
        private void ShowLightForm()
        {
            LightForm lightForm = new LightForm(this.light);

            lightForm.ShowDialog(this);
        }