Beispiel #1
0
 public DeviceControl(Device device, List <Device> deviceList, IDeviceControl specialControl, DeviceManager manager)
 {
     this.device  = device;
     devices      = deviceList;
     CTR          = specialControl;
     this.manager = manager;
     InitializeType();
     CTR.Initializer();
     InitializerBase();
 }
Beispiel #2
0
        public void InitializerBase()
        {
            string id = device.Id.ToString();

            CssClass = "col-md-3 devicePanel";

            if (device.TurnOn)
            {
                switchLabel = ControlConstructorHelper.GenerateLabel("ON" + "<br/>");
            }
            else
            {
                switchLabel = ControlConstructorHelper.GenerateLabel("OFF" + "<br/>");
            }

            consumptionLabel = ControlConstructorHelper.GenerateLabel("Consumption: " + device.Consumption.ToString() + "<span class=\"kW\"> kW*h</span>");
            applyButton      = GenerateApplyButton(id);
            deleteButton     = GenerateDeleteButton(id);
            switchButton     = GenerateSwitchButton(id);

            switchButton.CssClass = " btn switchButton";
            applyButton.CssClass  = "btn btn-primary applyButton";
            deleteButton.CssClass = " btn btn-danger deleteButton";


            Panel innerPanel = new Panel();

            innerPanel.CssClass = "col-md-12 text-center basePanel";
            innerPanel.Controls.Add(ControlConstructorHelper.GenerateBootstrapDiv(consumptionLabel, 12));

            Panel panelRow = new Panel();

            panelRow.CssClass = "row";
            panelRow.Controls.Add(ControlConstructorHelper.GenerateBootstrapDiv(switchButton, 7));
            panelRow.Controls.Add(ControlConstructorHelper.GenerateBootstrapDiv(switchLabel, 4));

            panelRow.Controls.Add(ControlConstructorHelper.GenerateBootstrapDiv(applyButton, 6));
            panelRow.Controls.Add(ControlConstructorHelper.GenerateBootstrapDiv(deleteButton, 6));

            innerPanel.Controls.Add(panelRow);
            Controls.Add(CTR.Initializer());
            Controls.Add(innerPanel);
        }
Beispiel #3
0
 public void InitializerControl(IDeviceControl specialControl)
 {
     CTR = specialControl;
     Controls.Add(CTR.Initializer());
 }