Beispiel #1
0
        private MultiInputGroup CreateSingleBackendCollum(string name, BackendProperty backendProperty)
        {
            MultiInputGroup backendMultiInputGroup = new MultiInputGroup();

            backendMultiInputGroup.AppendLabel(name, 115 + 80);
            TwoStateButtonGroup backendEnabled = backendMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Vom Server", "Als Debug", backendProperty.RequestDataFromBackend, !backendProperty.RequestDataFromBackend), false);
            StylableTextInput   backendPath    = backendMultiInputGroup.AppendTextInput("Pfad zur WebAPI", startText: backendProperty.DataSourcePath);

            _backendPathTextInputDictionary.Add(name, backendPath);
            backendMultiInputGroup.AppendValidation("Einstellungen OK", "Einstellungen sind nicht OK", false);
            Button backendSaveSettings = backendMultiInputGroup.AppendCustomElement(new Button(StylingColor.Success, true, text: "Speichern", fontAwesomeIcon: "save"), false);

            backendSaveSettings.Click += (sender, args) =>
            {
                backendPath.SetValidation(false, false);
                if (backendEnabled.FirstButtonActive && Uri.IsWellFormedUriString(backendPath.Value, UriKind.Absolute))
                {
                    try
                    {
                        if (JsonConvert.DeserializeObject <bool>(new HttpClient().GetAsync(backendPath.Value + "/enabled").EnsureResultSuccessStatusCode().Result.Content.ReadAsStringAsync().Result) == false)
                        {
                            //TODO: ich brauche eine Messagebox
                            backendPath.Value = "Der Server hat diese API verweigert! Pfad:" + backendPath.Value;
                            throw new Exception(backendPath.Value);
                        }
                        backendPath.SetValidation(true, false);
                        backendProperty.RequestDataFromBackend = backendEnabled.FirstButtonActive;
                        backendProperty.DataSourcePath         = backendPath.Value;
                    }
                    catch (Exception e)
                    {
                        backendPath.Value       = "Der Verbindungsversuch ist fehlgeschlagen! Pfad:" + backendPath.Value;
                        Console.ForegroundColor = ConsoleColor.Yellow;
                        Console.WriteLine("Beim Versuch die neuen BackendEinstellungen zu Testen ist ein Fehler aufgetreten.");
                        Console.ResetColor();

                        Logging.WriteLog("System", "Warn", $"Beim Versuch die Backendeinstellungen für {name} des Servers zu validieren ist es zu folgendem Fehler gekommen:\r\n{e.Message}");

                        backendPath.SetValidation(false, true);
                        //TODO: ich brauche eine Messagebox
                    }
                }
                else if (backendEnabled.SecondButtonActive)
                {
                    backendPath.SetValidation(true, false);
                    backendProperty.RequestDataFromBackend = backendEnabled.FirstButtonActive;
                }
                else
                {
                    backendPath.SetValidation(false, true);
                }
            };
            backendMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            return(backendMultiInputGroup);
        }
Beispiel #2
0
        public OverrideInputGroup(int startValue, string labelText = "Dauer Relativ", int labelSizeInPx = -1, int increment = 5) : base("div")
        {
            MultiInputGroup multiInputGroup = new MultiInputGroup();

            multiInputGroup.AppendLabel(labelText, labelSizeInPx);
            OverrideTextInput             = multiInputGroup.AppendTextInput("100%", startText: startValue + "%");
            OverrideTextInput.Style.Width = 110;
            multiInputGroup.AppendValidation("", "Bitte nur ganze zahlen mit optionalem % Zeichen angeben!", false);
            Button incrementOverrideButton = new Button(StylingColor.Secondary, true, text: "+", widthInPx: 35);

            incrementOverrideButton.Click += (sender, args) =>
            {
                if (int.TryParse(OverrideTextInput.Value.Replace("%", ""), out int number))
                {
                    OverrideTextInput.Value = number + increment + "%";
                    OverrideTextInput.SetValidation(false, false);
                }
                else
                {
                    OverrideTextInput.SetValidation(false, true);
                }
            };
            multiInputGroup.AppendCustomElement(incrementOverrideButton, false);

            Button decrementOverrideButton = new Button(StylingColor.Secondary, true, text: "-", widthInPx: 35);

            decrementOverrideButton.Click += (sender, args) =>
            {
                if (int.TryParse(OverrideTextInput.Value.Replace("%", ""), out int number))
                {
                    OverrideTextInput.Value = number - increment + "%";
                    OverrideTextInput.SetValidation(false, false);
                }
                else
                {
                    OverrideTextInput.SetValidation(false, true);
                }
            };
            multiInputGroup.AppendCustomElement(decrementOverrideButton, false);

            multiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            multiInputGroup.AddStyling(StylingOption.MarginTop, 2);
            AppendChild(multiInputGroup);
        }
Beispiel #3
0
        private void AddHumiditySensor(ChannelData channel, Grid grid)
        {
            List <StylableAnchor> humiditySensorEntries = new List <StylableAnchor>();

            MultiInputGroup humiditySensorMultiInputGroup = new MultiInputGroup();

            humiditySensorMultiInputGroup.AddStyling(StylingOption.MarginTop, 4);
            humiditySensorMultiInputGroup.AppendLabel("Feuchtigkeitssensor");
            _humiditySensorEnabledTwoStateButtonGroup = new TwoStateButtonGroup("Aktiv", "Inaktiv", channel.HumiditySensorEnabled, !channel.HumiditySensorEnabled);
            humiditySensorMultiInputGroup.AppendCustomElement(_humiditySensorEnabledTwoStateButtonGroup, false);

            _humiditySensorDropdown = new Dropdown(new Button(StylingColor.Secondary, true, text: "N/A"));
            _humiditySensorDropdown.Button.SetAttribute("data-realName", channel.HumiditySensor);
            Anchor humiditySensorNone = _humiditySensorDropdown.AddEntry("Ohne", _humiditySensorDropdown.Button.GetAttribute("data-realName").ToString() == "");

            humiditySensorNone.Click += (sender, args) =>
            {
                _humiditySensorDropdown.Button.SetAttribute("data-realName", "");
                UpdateHumiditySensorDropDown(humiditySensorEntries, humiditySensorNone);
            };
            _humiditySensorDropdown.AddDivider();
            foreach ((string realSensorName, string customSensorName) in PageStorage <SettingsData> .Instance.StorageData.HumiditySensors)
            {
                StylableAnchor humiditySensorEntry = _humiditySensorDropdown.AddEntry(customSensorName, _humiditySensorDropdown.Button.GetAttribute("data-realName").ToString() == realSensorName);
                humiditySensorEntry.SetToolTip(ToolTipLocation.Right, realSensorName);
                humiditySensorEntry.Click += (sender, args) =>
                {
                    _humiditySensorDropdown.Button.SetAttribute("data-realName", realSensorName);
                    UpdateHumiditySensorDropDown(humiditySensorEntries, humiditySensorNone);
                };
                humiditySensorEntry.SetAttribute("data-realName", realSensorName);

                humiditySensorEntries.Add(humiditySensorEntry);
            }
            UpdateHumiditySensorDropDown(humiditySensorEntries, humiditySensorNone);
            humiditySensorMultiInputGroup.AppendCustomElement(_humiditySensorDropdown, false);

            grid.AddRow().AppendCollum(humiditySensorMultiInputGroup, autoSize: true);
        }
Beispiel #4
0
        public SettingsPage(PageStorage <SettingsData> settingsData) : base("div")
        {
            bool useSafeLoading = false;

            if (settingsData.TryLoad() == false)
            {
                settingsData.UseSafeLoading();
                useSafeLoading = true;
            }
            if (PageStorage <HumiditySensorData> .Instance.TryLoad() == false)
            {
                PageStorage <HumiditySensorData> .Instance.UseSafeLoading();

                useSafeLoading = true;
            }
            this.AddScriptDependency("/lib/bootstrap3-typeahead.min.js");
            const int labelSize = 180;

            _settingsData = settingsData;

            #region Initialize Grid

            Container wrappingContainer = new Container(this);
            Grid      grid = new Grid(wrappingContainer);

            grid.AddStyling(StylingOption.MarginRight, 2);
            grid.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddStyling(StylingOption.MarginTop, 4);
            grid.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Initialize Grid

            if (useSafeLoading)
            {
                grid.AddRow().AppendCollum(new Heading(3, "Wegen Verbindungsproblemem wurden keine Daten geladen!")
                {
                    Style = { Color = Color.Red }
                });
            }

            #region AutoEnabled

            MultiInputGroup autoEnabledMultiInputGroup = new MultiInputGroup();
            autoEnabledMultiInputGroup.AppendLabel("Automatik", labelSize);
            autoEnabledMultiInputGroup
            .AppendCustomElement(
                new TwoStateButtonGroup("Aktiv", "Inaktiv", settingsData.StorageData.Enabled,
                                        !settingsData.StorageData.Enabled), false).FirstButtonStateChange += (sender, args) =>
                                                                                                             settingsData.StorageData.Enabled = args.NewButtonState;
            autoEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            autoEnabledMultiInputGroup.AppendCustomElement(new Button(StylingColor.Danger, true, Button.ButtonSize.Normal, false, "Alle Kanäle ausschalten", fontAwesomeIcon: "stop"), false).Click += (sender, args) =>
            {
                ServerConnection.DeleteAsync("settings", "stopall");
            };
            grid.AddRow().AppendCollum(autoEnabledMultiInputGroup, autoSize: true);

            #endregion AutoEnabled

            #region WeatherEnabled

            MultiInputGroup weatherEnabledMultiInputGroup = new MultiInputGroup();
            weatherEnabledMultiInputGroup.AppendLabel("Wetterdaten verwenden", labelSize);
            weatherEnabledMultiInputGroup
            .AppendCustomElement(
                new TwoStateButtonGroup("Aktiv", "Inaktiv", settingsData.StorageData.WeatherEnabled,
                                        !settingsData.StorageData.WeatherEnabled), false).FirstButtonStateChange += (sender, args) =>
                                                                                                                    settingsData.StorageData.WeatherEnabled = args.NewButtonState;
            weatherEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            grid.AddRow().AppendCollum(weatherEnabledMultiInputGroup, autoSize: true);

            #endregion WeatherEnabled

            #region Location

            Row locationRow = grid.AddRow();
            locationRow.AddStyling(StylingOption.MarginBottom, 2);
            MultiInputGroup weatherLocationMultiInputGroup = new MultiInputGroup();
            weatherLocationMultiInputGroup.AppendLabel("Standort", labelSize);

            StylableTextInput weatherLocationTextInput = weatherLocationMultiInputGroup.AppendTextInput("Bitte Eintragen...", false);
            weatherLocationTextInput.Value = settingsData.StorageData.LocationFriendlyName;

            #region Hidden TextInputs

            TextInput weatherLocationChangeTextInput = new TextInput {
                IsHidden = true, Value = settingsData.StorageData.Location
            };

            locationRow.AppendChild(weatherLocationChangeTextInput);
            TextInput weatherLocationNameChangeTextInput = new TextInput {
                IsHidden = true, Value = settingsData.StorageData.LocationFriendlyName
            };

            locationRow.AppendChild(weatherLocationNameChangeTextInput);

            #endregion Hidden TextInputs

            #region Autocomplete

            weatherLocationTextInput.ActivateAutocomplete("/settings/WeatherLocations.json", new Dictionary <string, TextInput>()
            {
                { "location", weatherLocationChangeTextInput },
                { "name", weatherLocationNameChangeTextInput }
            });

            #endregion Autocomplete

            locationRow.AppendCollum(weatherLocationMultiInputGroup, autoSize: true);

            #region Save Button

            Button saveLocationButton = new Button(StylingColor.Success, true, text: "Übernehmen");
            saveLocationButton.Click += (sender, args) =>
            {
                if (weatherLocationChangeTextInput.Value == "")
                {
                    weatherLocationTextInput.SetValidation(false, true);
                }
                else
                {
                    weatherLocationTextInput.SetValidation(false, false);
                    settingsData.StorageData.Location             = weatherLocationChangeTextInput.Value;
                    settingsData.StorageData.LocationFriendlyName = weatherLocationNameChangeTextInput.Value;
                    weatherLocationTextInput.Value = settingsData.StorageData.LocationFriendlyName;
                }
            };
            locationRow.AppendCollum(saveLocationButton, autoSize: true);

            #endregion Save Button

            #endregion Location

            #region Override

            _overrideInputGroup = new OverrideInputGroup(_settingsData.StorageData.OverrideValue, labelSizeInPx: labelSize);
            grid.AddRow().AppendCollum(_overrideInputGroup, autoSize: true);

            #endregion Override

            #region Rename HumiditySensors

            Row humidityRow = grid.AddRow();
            humidityRow.AppendChild(new Heading(3, "Feuchigkeitssensoren Umbenennen"));
            humidityRow.AddNewLine();

            #region Sync Server HumidityList with Storage

            foreach (string humiditySensor in PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors)
            {
                if (settingsData.StorageData.HumiditySensors.ContainsKey(humiditySensor) == false)
                {
                    settingsData.StorageData.HumiditySensors.Add(humiditySensor, humiditySensor);
                }
            }

            List <string> removeList = new List <string>();
            foreach ((string realSensorName, string _) in settingsData.StorageData.HumiditySensors)
            {
                if (PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors.Contains(realSensorName) == false)
                {
                    removeList.Add(realSensorName);
                }
            }

            foreach (string s in removeList)
            {
                settingsData.StorageData.HumiditySensors.Remove(s);
            }

            #endregion Sync Server HumidityList with Storage

            _humidityDropdown = new Dropdown(new Button(StylingColor.Secondary, true, widthInPx: 150));
            humidityRow.AppendCollum(_humidityDropdown, autoSize: true);

            foreach (string humiditySensor in PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors)
            {
                StylableAnchor stylableAnchor = _humidityDropdown.AddEntry(humiditySensor);
                stylableAnchor.Click += (sender, args) => SelectHumiditySensor(humiditySensor);
            }

            _humiditySensorTextInputGroup = new TextInputGroup("Freundlicher Name", "Bitte Eingeben!");
            humidityRow.AppendCollum(_humiditySensorTextInputGroup, autoSize: true);

            Button button = new Button(StylingColor.Success, true, text: "Übernehmen");
            button.Click += (sender, args) =>
            {
                if (_humidityDropdown.Button.Text != "")
                {
                    _settingsData.StorageData.HumiditySensors[_humidityDropdown.Button.Text] = _humiditySensorTextInputGroup.TextInput.Value;
                }
            };

            humidityRow.AppendCollum(button, autoSize: true);
            if (PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors.Count > 0)
            {
                SelectHumiditySensor(PageStorage <HumiditySensorData> .Instance.StorageData.HumiditySensors.First());
            }
            else
            {
                humidityRow.IsHidden = true;
            }
            humidityRow.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Rename HumiditySensors

            #region Backend Server Path

            grid.AddRow().AppendCollum(new Heading(3, "Backend Server Schnittstelle einstellen")
            {
                ClassName = "text-center mb-4"
            });
            Row backendServerRow = grid.AddRow();
            Row backendServerConfigurationSingeApiRow = grid.AddRow();
            Row backendServerConfigurationMultiApiRow = grid.AddRow();
            backendServerRow.AddNewLine();

            BackendData backendInstanceStorageData = PageStorage <BackendData> .Instance.StorageData;

            MultiInputGroup backendConfigurationSourceSwitchingMultiInputGroup = backendServerRow.AppendCollum(new MultiInputGroup());
            backendConfigurationSourceSwitchingMultiInputGroup.AppendLabel("Quelle Auswählen", labelSize);
            TwoStateButtonGroup backendConfigurationSourceSwitchingTwoStateButton = backendConfigurationSourceSwitchingMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Sammelkonfiguration", "einzele Konfiguration", !backendInstanceStorageData.SingleApiConfiguration, backendInstanceStorageData.SingleApiConfiguration), false);

            void OnBackendConfigurationSourceSwitchingTwoStateButtonOnFirstButtonStateChange(object sender, ButtonChangeEventHandlerArgs args)
            {
                if (args.NewButtonState == true)
                {
                    backendServerConfigurationSingeApiRow.Style.Display = "none";
                    backendServerConfigurationMultiApiRow.Style.Display = null;
                }
                else
                {
                    backendServerConfigurationSingeApiRow.Style.Display = null;
                    backendServerConfigurationMultiApiRow.Style.Display = "none";
                }

                backendInstanceStorageData.SingleApiConfiguration = !args.NewButtonState;
            }

            backendConfigurationSourceSwitchingTwoStateButton.FirstButtonStateChange += OnBackendConfigurationSourceSwitchingTwoStateButtonOnFirstButtonStateChange;
            OnBackendConfigurationSourceSwitchingTwoStateButtonOnFirstButtonStateChange(null, new ButtonChangeEventHandlerArgs(false, !backendInstanceStorageData.SingleApiConfiguration));
            backendConfigurationSourceSwitchingMultiInputGroup.AddStyling(StylingOption.MarginBottom, 5);

            #region backendServerConfigurationSingeApiRow

            foreach ((string name, BackendProperty backedProperties) in backendInstanceStorageData.BackendProperties)
            {
                backendServerConfigurationSingeApiRow.AddNewLine();
                backendServerConfigurationSingeApiRow.AppendCollum(CreateSingleBackendCollum(name, backedProperties), autoSize: true);
            }

            backendServerConfigurationSingeApiRow.AddNewLine();
            backendServerConfigurationSingeApiRow.AddNewLine();
            backendServerConfigurationSingeApiRow.AppendCollum(new Button(StylingColor.Light, false, Button.ButtonSize.Normal, false, "Standardkonfiguration eintragen")).Click += (sender, args) =>
            {
                foreach ((string name, BackendProperty _) in backendInstanceStorageData.BackendProperties)
                {
                    if (_backendPathTextInputDictionary[name].Value == "")
                    {
                        _backendPathTextInputDictionary[name].Value = $"http://{Dns.GetHostAddresses("WebPiServer.PiWeb")[0].ToString()}:5000/api/{name}";
                    }
                }
            };

            #endregion backendServerConfigurationSingeApiRow

            #region backendServerConfigurationMultiApiRow

            backendServerConfigurationMultiApiRow.AppendCollum(CreateMultiBackendCollum(backendInstanceStorageData, out StylableTextInput backendServerConfigurationMultiApiTextInput), autoSize: true);
            backendServerConfigurationMultiApiRow.AddNewLine();
            backendServerConfigurationMultiApiRow.AppendCollum(new Button(StylingColor.Light, false, Button.ButtonSize.Normal, false, "Standardkonfiguration eintragen")).Click += (sender, args) =>
            {
                if (backendServerConfigurationMultiApiTextInput.Value == "")
                {
                    backendServerConfigurationMultiApiTextInput.Value = $"http://{Dns.GetHostAddresses("WebPiServer.PiWeb")[0].ToString()}:5000/api";
                }
            };

            #endregion backendServerConfigurationMultiApiRow

            #endregion Backend Server Path
        }
Beispiel #5
0
        public JobPage(JobEntry job, ManualPage parent) : base("div")
        {
            this._job = job;
            SetBorder(BorderKind.Rounded, StylingColor.Secondary);

            #region Initialize Grid

            Grid grid = new Grid(this);
            grid.AddStyling(StylingOption.MarginRight, 2);
            grid.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddStyling(StylingOption.MarginTop, 4);
            grid.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Initialize Grid

            #region JobName

            MultiInputGroup jobNameMultiInputGroup = new MultiInputGroup();
            jobNameMultiInputGroup.AppendLabel("JobName");
            StylableTextInput jobNameTextInput = jobNameMultiInputGroup.AppendTextInput("Name?", startText: job.Name);
            jobNameMultiInputGroup.AppendValidation("", "Ein Job mit diesem Namen existiert bereits", false);
            Button saveJobNameButton = jobNameMultiInputGroup.AppendCustomElement(new Button(StylingColor.Success, asOutline: true, text: "Namen übernehmen", fontAwesomeIcon: "save"), false);
            Button deleteJobButton   = jobNameMultiInputGroup.AppendCustomElement(new Button(StylingColor.Danger, asOutline: true, text: "Job Löschen", fontAwesomeIcon: "trash"), false);
            deleteJobButton.Click += (sender, args) =>
            {
                const string confirmMessage = "Wirklich Löschen";
                if (deleteJobButton.Text != confirmMessage)
                {
                    deleteJobButton.Text = confirmMessage;
                    return;
                }
                else
                {
                    PageStorage <ManualData> .Instance.StorageData.JobEntries.Remove(job);

                    parent.UpdateJobs();
                }
            };

            saveJobNameButton.Click += (sender, args) =>
            {
                if (PageStorage <ManualData> .Instance.StorageData.JobEntries.Any(entry => entry.Name == jobNameTextInput.Value))
                {
                    if (job.Name == jobNameTextInput.Value)
                    {
                        return;
                    }
                    else
                    {
                        jobNameTextInput.SetValidation(false, true);
                    }
                }
                else
                {
                    jobNameTextInput.SetValidation(true, false);
                    job.Name = jobNameTextInput.Value;
                    parent.UpdateJobs();
                }
            };
            grid.AddRow().AppendCollum(jobNameMultiInputGroup, autoSize: true);

            #endregion JobName

            #region ExecuteJob

            #region Init Container

            Container firstContainer = new Container();
            firstContainer.SetBorder(BorderKind.Rounded, StylingColor.Info);
            firstContainer.AddStyling(StylingOption.MarginTop, 3);
            firstContainer.AddStyling(StylingOption.MarginBottom, 1);
            firstContainer.AddStyling(StylingOption.PaddingTop, 3);
            firstContainer.AddStyling(StylingOption.PaddingBottom, 2);
            grid.AddRow().AppendCollum(firstContainer, autoSize: true);

            #endregion Init Container

            #region create Heading

            Heading firstHeading = new Heading(5, "Job Ausführen ...");
            firstContainer.AppendChild(firstHeading);

            #endregion create Heading

            #region Override

            OverrideInputGroup overrideInputGroup = new OverrideInputGroup(100);
            firstContainer.AppendChild(overrideInputGroup);

            #endregion Override

            #region StartButton

            Button startButton = new Button(StylingColor.Success, true, text: "Einreihen!", fontAwesomeIcon: "plus-circle", asBlock: true);
            firstContainer.AppendChild(startButton);
            startButton.Click += (o, args) =>
            {
                startButton.IsDisabled = true;
                try
                {
                    CreateJobAction(job, overrideInputGroup.Value);

                    startButton.Text = "Wurde Eingereiht";
                    Task.Run(() =>
                    {
                        System.Threading.Thread.Sleep(5000);
                        startButton.Text = "Einreihen!";
                        startButton.SetFontAwesomeIcon("plus-circle");
                        return(startButton.IsDisabled = false);
                    });
                }
                catch (Exception)
                {
                    startButton.Text = "Einreihen fehlgeschlagen";
                    throw;
                }
            };
            firstContainer.AppendChild(startButton);
            startButton.AddStyling(StylingOption.MarginBottom, 2);

            #endregion StartButton

            #endregion ExecuteJob

            grid.AddRow().AppendCollum(new Heading(4, "Batch Einträge"), autoSize: true);
            List batchEntries = grid.AddRow().AppendCollum(new List(false), autoSize: true);
            foreach (BatchEntry jobBatchEntry in job.BatchEntries)
            {
                batchEntries.AppendChild(new ListItem()
                {
                    Text = $"{jobBatchEntry.Name} {jobBatchEntry.ToString()}"
                });
            }
        }
Beispiel #6
0
        public ChannelProgrammPage(ChannelProgramData channelProgram, ChannelPage parentChannelPage, bool isMasterChannel) : base("div")
        {
            const int labelSize = 235;

            _channelProgram    = channelProgram;
            _parentChannelPage = parentChannelPage;

            #region Initialize Grid

            Grid grid = new Grid(this);
            grid.AddStyling(StylingOption.MarginRight, 2);
            grid.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddStyling(StylingOption.MarginTop, 2);
            grid.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Initialize Grid

            #region TextInputGroup ProgrammName

            _programmNameInputGroup = new TextInputGroup("ProgrammName", "N/A", labelSize, centeredText: true);
            _programmNameInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _programmNameInputGroup.TextInput.Value = channelProgram.Name;
            _deleteProgrammButton        = new MyOoui.HtmlElements.Button(StylingColor.Danger, asOutline: true, text: "Programm Löschen", fontAwesomeIcon: "trash");
            _deleteProgrammButton.Click += DeleteProgrammButtonOnClick;
            _programmNameInputGroup.AddFormElement(_deleteProgrammButton);
            grid.AddRow().AppendCollum(_programmNameInputGroup);

            #endregion TextInputGroup ProgrammName

            #region InputGroup > TwoStateButtonGroup ProgrammStatus

            MultiInputGroup programmEnabledMultiInputGroup = new MultiInputGroup();
            programmEnabledMultiInputGroup.AppendLabel("Programmstatus", labelSize);
            programmEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _programmEnabled = programmEnabledMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Aktiv", "Inaktiv", channelProgram.Enabled, !channelProgram.Enabled), false);
            grid.AddRow().AppendCollum(programmEnabledMultiInputGroup, autoSize: true);

            #endregion InputGroup > TwoStateButtonGroup ProgrammStatus

            #region TextInputGroup StartZeit

            _startTimeInputGroup = new TextInputGroup("StartZeit", "N/A", labelSize, "", "Das angegebene Zeitformat passt nicht. Bitte Zeiten im Format  hh:mm:ss  angeben.");
            _startTimeInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _startTimeInputGroup.TextInput.Value = channelProgram.StartTime.ToString();
            grid.AddRow().AppendCollum(_startTimeInputGroup);

            #endregion TextInputGroup StartZeit

            #region TextInputGroup Dauer

            _durationInputGroup = new TextInputGroup("Dauer", "N/A", labelSize, "", "Das angegebene Zeitformat passt nicht. Bitte Zeiten im Format  hh:mm:ss  angeben.");
            _durationInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _durationInputGroup.TextInput.Value = channelProgram.Duration.ToString();
            grid.AddRow().AppendCollum(_durationInputGroup);

            #endregion TextInputGroup Dauer

            #region Row Declaration

            Row downRow = new Row();
            grid.AddRow().AppendCollum(downRow);
            Row weekDaysRow = new Row();
            downRow.AppendCollum(weekDaysRow, sizing: 4);
            Row otherRow = new Row();
            downRow.AppendCollum(otherRow, sizing: 8);

            #endregion Row Declaration

            #region Weekdays

            _weekdaysMoMiFrRadioButtonLabeledInputGroup = new RadioButtonLabeledInputGroup(GetCheckedWeekdays(channelProgram.ChoosenWeekdays) == 1, "Mo, Mi, Fr");
            //_weekdaysMoMiFrRadioButtonLabeledInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _weekdaysMoMiFrRadioButtonLabeledInputGroup.AddStyling(StylingOption.MarginLeft, 2);
            weekDaysRow.AppendCollum(_weekdaysMoMiFrRadioButtonLabeledInputGroup);
            weekDaysRow.AddNewLine();

            _weekdaysDiDoRadioButtonLabeledInputGroup = new RadioButtonLabeledInputGroup(GetCheckedWeekdays(channelProgram.ChoosenWeekdays) == 2, "Di, Do", _weekdaysMoMiFrRadioButtonLabeledInputGroup.RadioButtonGroupName);
            //_weekdaysDiDoRadioButtonLabeledInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _weekdaysDiDoRadioButtonLabeledInputGroup.AddStyling(StylingOption.MarginLeft, 2);
            weekDaysRow.AppendCollum(_weekdaysDiDoRadioButtonLabeledInputGroup);
            weekDaysRow.AddNewLine();

            _weekdaysSaSoRadioButtonLabeledInputGroup = new RadioButtonLabeledInputGroup(GetCheckedWeekdays(channelProgram.ChoosenWeekdays) == 3, "Sa, So", _weekdaysMoMiFrRadioButtonLabeledInputGroup.RadioButtonGroupName);
            //_weekdaysSaSoRadioButtonLabeledInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _weekdaysSaSoRadioButtonLabeledInputGroup.AddStyling(StylingOption.MarginLeft, 2);
            weekDaysRow.AppendCollum(_weekdaysSaSoRadioButtonLabeledInputGroup);
            weekDaysRow.AddNewLine();

            _weekdaysChoosenToggleButtonGroup = new ToggleButtonGroup(StylingColor.Primary, StylingColor.Secondary);
            _weekdaysChoosenToggleButtonGroup.AddToggleButton("Mo", (channelProgram.ChoosenWeekdays & ChannelProgramData.Weekdays.Montag) == ChannelProgramData.Weekdays.Montag);
            _weekdaysChoosenToggleButtonGroup.AddToggleButton("Di", (channelProgram.ChoosenWeekdays & ChannelProgramData.Weekdays.Dienstag) == ChannelProgramData.Weekdays.Dienstag);
            _weekdaysChoosenToggleButtonGroup.AddToggleButton("Mi", (channelProgram.ChoosenWeekdays & ChannelProgramData.Weekdays.Mittwoch) == ChannelProgramData.Weekdays.Mittwoch);
            _weekdaysChoosenToggleButtonGroup.AddToggleButton("Do", (channelProgram.ChoosenWeekdays & ChannelProgramData.Weekdays.Donnerstag) == ChannelProgramData.Weekdays.Donnerstag);
            _weekdaysChoosenToggleButtonGroup.AddToggleButton("Fr", (channelProgram.ChoosenWeekdays & ChannelProgramData.Weekdays.Freitag) == ChannelProgramData.Weekdays.Freitag);
            _weekdaysChoosenToggleButtonGroup.AddToggleButton("Sa", (channelProgram.ChoosenWeekdays & ChannelProgramData.Weekdays.Samstag) == ChannelProgramData.Weekdays.Samstag);
            _weekdaysChoosenToggleButtonGroup.AddToggleButton("So", (channelProgram.ChoosenWeekdays & ChannelProgramData.Weekdays.Sonntag) == ChannelProgramData.Weekdays.Sonntag);
            _weekDaysChoosenRadioButtonInputGroup = new RadioButtonInputGroup(GetCheckedWeekdays(channelProgram.ChoosenWeekdays) == 4, _weekdaysChoosenToggleButtonGroup, _weekdaysMoMiFrRadioButtonLabeledInputGroup.RadioButtonGroupName, false);
            _weekDaysChoosenRadioButtonInputGroup.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddRow().AppendCollum(_weekDaysChoosenRadioButtonInputGroup, autoSize: true);

            #endregion Weekdays

            #region InputGroup > TwoStateButtonGroup WetterInfos

            MultiInputGroup weatherEnabledMultiInputGroup = new MultiInputGroup();
            weatherEnabledMultiInputGroup.AppendLabel("WetterInfos verwenden", labelSize);
            weatherEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _weatherInfo = weatherEnabledMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Aktiv", "Inaktiv", channelProgram.ActivateWeatherInfo, !channelProgram.ActivateWeatherInfo), false);
            otherRow.AppendCollum(weatherEnabledMultiInputGroup, autoSize: true);

            #endregion InputGroup > TwoStateButtonGroup WetterInfos

            otherRow.AddNewLine();

            #region InputGroup > TwoStateButtonGroup Master Kanal

            MultiInputGroup activateMasterMultiInputGroup = new MultiInputGroup();
            activateMasterMultiInputGroup.AppendLabel("Master Kanal auch Einschalten", labelSize);
            _activateMasterChannel = activateMasterMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Aktiv", "Inaktiv", channelProgram.EnableMasterChannel, !channelProgram.EnableMasterChannel), false);
            otherRow.AppendCollum(activateMasterMultiInputGroup, autoSize: true);

            #endregion InputGroup > TwoStateButtonGroup Master Kanal

            #region TextAreaInputGroup Notizen

            _descriptionInputGroup = new TextAreaInputGroup("Notizen", "", labelSize);
            _descriptionInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            _descriptionInputGroup.AddStyling(StylingOption.MarginTop, 2);
            _descriptionInputGroup.TextArea.Value = channelProgram.Description;
            grid.AddRow().AppendCollum(_descriptionInputGroup);

            #endregion TextAreaInputGroup Notizen

            if (isMasterChannel)
            {
                _activateMasterChannel.IsDisabled = true;
            }
        }
Beispiel #7
0
        public BatchPage(BatchEntry batch, ManualPage parent) : base("div")
        {
            const int labelSize = 100;

            _batch = batch;
            SetBorder(BorderKind.Rounded, StylingColor.Secondary);

            #region Initialize Grid

            Grid grid = new Grid(this);
            grid.AddStyling(StylingOption.MarginRight, 2);
            grid.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddStyling(StylingOption.MarginTop, 4);
            grid.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Initialize Grid

            #region JobName

            MultiInputGroup batchNameMultiInputGroup = new MultiInputGroup();
            batchNameMultiInputGroup.AppendLabel("BatchName", labelSize);
            StylableTextInput batchNameTextInput = batchNameMultiInputGroup.AppendTextInput("Name?", startText: batch.Name);
            batchNameMultiInputGroup.AppendValidation("", "Ein Batch-Auftrag mit diesem Namen existiert bereits", false);
            batchNameMultiInputGroup.AppendCustomElement(new Button(StylingColor.Success, asOutline: true, text: "Namen übernehmen", fontAwesomeIcon: "save"), false).Click += (sender, args) =>
            {
                if (batchNameTextInput.Value == "")
                {
                    batchNameTextInput.SetValidation(false, true);
                    return;
                }
                if (PageStorage <ManualData> .Instance.StorageData.BatchEntries.Any(entry => entry.Name == batchNameTextInput.Value))
                {
                    if (batch.Name == batchNameTextInput.Value)
                    {
                        return;
                    }
                    else
                    {
                        batchNameTextInput.SetValidation(false, true);
                    }
                }
                else
                {
                    batchNameTextInput.SetValidation(true, false);
                    foreach (BatchEntry entry in PageStorage <ManualData> .Instance.StorageData.JobEntries.SelectMany(
                                 entry => entry.BatchEntries.Where(batchEntry =>
                                                                   batchEntry.Name == batch.Name && batchEntry != batch)))
                    {
                        entry.Name = batchNameTextInput.Value;
                    }
                    batch.Name = batchNameTextInput.Value;
                    parent.UpdateBatch();
                }
            };

            Button deleteJobButton = batchNameMultiInputGroup.AppendCustomElement(new Button(StylingColor.Danger, asOutline: true, text: "Batch-Auftrag Löschen", fontAwesomeIcon: "trash"), false);
            deleteJobButton.Click += (sender, args) =>
            {
                const string confirmMessage = "Wirklich Löschen";
                if (deleteJobButton.Text != confirmMessage)
                {
                    deleteJobButton.Text = confirmMessage;
                    return;
                }
                else
                {
                    PageStorage <ManualData> .Instance.StorageData.BatchEntries.Remove(batch);

                    List <JobEntry> removeList = new List <JobEntry>();

                    foreach (JobEntry entry in PageStorage <ManualData> .Instance.StorageData.JobEntries.Where(entry =>
                                                                                                               entry.BatchEntries.Any(batchEntry => batchEntry.Name == batch.Name)))
                    {
                        entry.BatchEntries.RemoveAll(batchEntry => batchEntry.Name == batch.Name);
                        if (entry.BatchEntries.Count == 0)
                        {
                            removeList.Add(entry);
                        }
                    }

                    foreach (JobEntry jobEntry in removeList)
                    {
                        PageStorage <ManualData> .Instance.StorageData.JobEntries.Remove(jobEntry);
                    }

                    parent.UpdateBatch();
                    parent.UpdateJobs();
                }
            };

            batchNameMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            grid.AddRow().AppendCollum(batchNameMultiInputGroup, autoSize: true);

            MultiInputGroup batchActionMultiInputGroup = new MultiInputGroup();
            batchActionMultiInputGroup.AppendLabel("Aktion", labelSize);
            batchActionMultiInputGroup.AppendLabel(batch.ToString());
            batchActionMultiInputGroup.AddStyling(StylingOption.MarginBottom, 1);
            grid.AddRow().AppendCollum(batchActionMultiInputGroup, autoSize: true);

            #endregion JobName

            #region ExecuteAction

            #region Init Container

            Container firstContainer = new Container();
            firstContainer.SetBorder(BorderKind.Rounded, StylingColor.Info);
            firstContainer.AddStyling(StylingOption.MarginTop, 3);
            firstContainer.AddStyling(StylingOption.MarginBottom, 1);
            firstContainer.AddStyling(StylingOption.PaddingTop, 3);
            firstContainer.AddStyling(StylingOption.PaddingBottom, 2);
            grid.AddRow().AppendCollum(firstContainer, autoSize: true);

            #endregion Init Container

            #region create Heading

            Heading firstHeading = new Heading(5, "Batch Ausführen ...");
            firstContainer.AppendChild(firstHeading);

            #endregion create Heading

            #region Override

            OverrideInputGroup overrideInputGroup = new OverrideInputGroup(100);
            firstContainer.AppendChild(overrideInputGroup);

            #endregion Override

            #region StartButton

            Button startButton = new Button(StylingColor.Success, true, text: "Einreihen!", fontAwesomeIcon: "plus-circle", asBlock: true);
            firstContainer.AppendChild(startButton);
            startButton.Click += (o, args) =>
            {
                startButton.IsDisabled = true;
                try
                {
                    CreateBatchAction(batch, overrideInputGroup.Value);

                    startButton.Text = "Wurde Eingereiht";
                    Task.Run(() =>
                    {
                        System.Threading.Thread.Sleep(5000);
                        startButton.Text = "Einreihen!";
                        startButton.SetFontAwesomeIcon("plus-circle");
                        return(startButton.IsDisabled = false);
                    });
                }
                catch (Exception)
                {
                    startButton.Text = "Einreihen fehlgeschlagen";
                    throw;
                }
            };
            firstContainer.AppendChild(startButton);
            startButton.AddStyling(StylingOption.MarginBottom, 2);

            #endregion StartButton

            #endregion ExecuteAction

            #region AddToJob

            #region Init Container

            Container secondContainer = new Container();
            secondContainer.SetBorder(BorderKind.Rounded, StylingColor.Info);
            secondContainer.AddStyling(StylingOption.MarginTop, 3);
            secondContainer.AddStyling(StylingOption.MarginBottom, 1);
            secondContainer.AddStyling(StylingOption.PaddingTop, 3);
            secondContainer.AddStyling(StylingOption.PaddingBottom, 2);
            grid.AddRow().AppendCollum(secondContainer, autoSize: true);

            #endregion Init Container

            #region create Heading

            Heading heading = new Heading(5, "... zu Job-Auftrag hinzufügen");
            secondContainer.AppendChild(heading);

            #endregion create Heading

            #region JobName Input

            _jobNameMultiInputGroup = new MultiInputGroup();
            _jobNameMultiInputGroup.AddStyling(StylingOption.MarginTop, 4);
            _jobNameMultiInputGroup.AppendLabel("Name für den Job-Auftrag:");
            StylableTextInput jobNameTextInput = _jobNameMultiInputGroup.AppendTextInput("Name?");
            _jobNameMultiInputGroup.AppendValidation("", "Es gibt bereits einen Job mit diesem Namen", false);
            _jobNameMultiInputGroup.IsHidden = true;
            secondContainer.AppendChild(_jobNameMultiInputGroup);

            #endregion JobName Input

            #region jobSelect

            MultiInputGroup jobSelectMultiInputGroup = new MultiInputGroup();
            jobSelectMultiInputGroup.AddStyling(StylingOption.MarginTop, 4);
            jobSelectMultiInputGroup.AppendLabel("Ziel Job:");
            _jobSelectDropdown = jobSelectMultiInputGroup.AppendCustomElement(new Dropdown(new Button(StylingColor.Secondary, true, text: "Bitte Wählen!"), DropdownDirection.DropDown), false);
            FillJobDropDown();
            jobSelectMultiInputGroup.AppendValidation("", "Dieser Batch-Auftrag ist bereits Bestandteil des Jobs", true);
            secondContainer.AppendChild(jobSelectMultiInputGroup);

            #endregion jobSelect

            #region Appent To Job or Create New

            _appendToJobButton = new Button(StylingColor.Success, true, text: "Zu Job-Auftrag hinzufügen", fontAwesomeIcon: "save", asBlock: true);
            _appendToJobButton.AddStyling(StylingOption.MarginTop, 2);
            _appendToJobButton.Click += (sender, args) =>
            {
                if (batchNameTextInput.Value == "")
                {
                    jobNameTextInput.SetValidation(false, true);
                    return;
                }
                if (_jobSelectDropdown.Button.Text == NewJobString)
                {
                    if (PageStorage <ManualData> .Instance.StorageData.JobEntries.Any(entry => entry.Name == jobNameTextInput.Value) || jobNameTextInput.Value == "")
                    {
                        // Invalid entered Name
                        jobNameTextInput.SetValidation(false, true);
                    }
                    else
                    {
                        // Create Job
                        jobNameTextInput.SetValidation(true, false);
                        PageStorage <ManualData> .Instance.StorageData.JobEntries.Add(new JobEntry(jobNameTextInput.Value, batch));

                        parent.UpdateJobs();
                        _jobNameMultiInputGroup.IsHidden = true;
                        _jobSelectDropdown.Button.Text   = jobNameTextInput.Value;

                        _appendToJobButton.IsHidden   = true;
                        _removeFromJobButton.IsHidden = false;
                    }
                }
                else
                {
                    jobNameTextInput.SetValidation(false, false);

                    // Add To Job
                    PageStorage <ManualData> .Instance.StorageData.JobEntries.First(entry => entry.Name == _jobSelectDropdown.Button.Text).BatchEntries.Add(batch);

                    parent.UpdateJobs();

                    _appendToJobButton.IsHidden   = true;
                    _removeFromJobButton.IsHidden = false;
                }
            };
            secondContainer.AppendChild(_appendToJobButton);

            #endregion Appent To Job or Create New

            #region Remove From Job

            _removeFromJobButton = new Button(StylingColor.Danger, true, text: "Aus Job löschen", fontAwesomeIcon: "trash", asBlock: true);
            _removeFromJobButton.AddStyling(StylingOption.MarginTop, 2);
            _removeFromJobButton.IsHidden = true;
            _removeFromJobButton.Click   += (sender, args) =>
            {
                if (PageStorage <ManualData> .Instance.StorageData.JobEntries.Any(entry => entry.Name == _jobSelectDropdown.Button.Text))
                {
                    JobEntry jobEntry = PageStorage <ManualData> .Instance.StorageData.JobEntries.First(entry => entry.Name == _jobSelectDropdown.Button.Text);

                    jobEntry.BatchEntries.RemoveAll(entry => entry.Name == _batch.Name);
                    if (jobEntry.BatchEntries.Count == 0)
                    {
                        PageStorage <ManualData> .Instance.StorageData.JobEntries.Remove(jobEntry);
                    }
                }
                _removeFromJobButton.IsHidden = true;
                _appendToJobButton.IsHidden   = false;
                FillJobDropDown();
                parent.UpdateJobs();
            };
            secondContainer.AppendChild(_removeFromJobButton);

            #endregion Remove From Job

            #endregion AddToJob
        }
Beispiel #8
0
        public ChannelPage(ChannelData channel, ChannelsPage parentChannelsPage, bool isMasterChannel) : base("div")
        {
            _channel            = channel;
            _parentChannelsPage = parentChannelsPage;
            _isMasterChannel    = isMasterChannel;
            SetBorder(BorderKind.Rounded, StylingColor.Secondary);

            #region Initialize Grid

            Grid grid = new Grid(this);
            grid.AddStyling(StylingOption.MarginRight, 2);
            grid.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddStyling(StylingOption.MarginTop, 4);
            grid.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Initialize Grid

            #region TextInputGroup ProgrammName

            MultiInputGroup channelNameMultiInputGroup = new MultiInputGroup();
            channelNameMultiInputGroup.AppendLabel("Kanal:");
            channelNameMultiInputGroup.AppendLabel(channel.ChannelId.ToString());
            channelNameMultiInputGroup.AppendLabel("  Name:");
            _channelNameTextInput = channelNameMultiInputGroup.AppendTextInput("Kanalname?", true, channel.Name);

            channelNameMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);

            if (!isMasterChannel)
            {
                _deleteChannelButton        = new Button(StylingColor.Danger, asOutline: true, text: "Kanal Löschen", fontAwesomeIcon: "trash");
                _deleteChannelButton.Click += DeleteChannelButtonOnClick;
                channelNameMultiInputGroup.AppendCustomElement(_deleteChannelButton, false);
            }
            else
            {
                _channelNameTextInput.IsDisabled = true;
            }
            grid.AddRow().AppendCollum(channelNameMultiInputGroup);

            #endregion TextInputGroup ProgrammName

            #region add TabNavigate

            _tabNavigation = new TabNavigation(true, true);
            _tabNavigation.AddButton.Click += (sender, args) =>
            {
                ChannelProgramData channelProgramData = ChannelProgramData.CreateNew(channel.ProgramList.Count > 0 ? channel.ProgramList.Max(data => int.TryParse(data.Name, out int parsedInt) ? parsedInt : 1) + 1 : 1);
                channel.ProgramList.Add(channelProgramData);
                ChannelProgrammPage channelProgrammPage = new ChannelProgrammPage(channelProgramData, this, isMasterChannel);
                _channelProgrammPages.Add(channelProgrammPage);
                _tabDictionary.Add(channelProgramData, _tabNavigation.AddTab(channelProgramData.Id.ToString(), channelProgrammPage, channelProgramData.Id == 1));
            };
            grid.AddRow().AppendCollum(_tabNavigation);

            #endregion add TabNavigate

            #region add ChannelProgrammPages

            foreach (ChannelProgramData channelProgramData in channel.ProgramList)
            {
                ChannelProgrammPage channelProgrammPage = new ChannelProgrammPage(channelProgramData, this, isMasterChannel);
                _channelProgrammPages.Add(channelProgrammPage);
                _tabDictionary.Add(channelProgramData, _tabNavigation.AddTab(channelProgramData.Id.ToString(), channelProgrammPage, channelProgramData.Id == channel.ProgramList.First().Id));
                ApplyName(channelProgramData);
            }

            #endregion add ChannelProgrammPages

            #region AddHumiditySensor

            AddHumiditySensor(channel, grid);

            _humiditySensorDropdown.Button.IsDisabled            = _isMasterChannel;
            _humiditySensorEnabledTwoStateButtonGroup.IsDisabled = _isMasterChannel;

            #endregion AddHumiditySensor

            #region SaveChannel Button

            Button saveButton = new Button(StylingColor.Success, true, Button.ButtonSize.Normal, false, "Speichern", fontAwesomeIcon: "save");
            saveButton.AddStyling(StylingOption.MarginTop, 4);
            saveButton.AddStyling(StylingOption.MarginLeft, 4);
            saveButton.AddStyling(StylingOption.MarginBottom, 1);
            saveButton.AddStyling(StylingOption.PaddingLeft, 5);
            saveButton.AddStyling(StylingOption.PaddingRight, 5);
            saveButton.Click += SaveButton_Click;
            grid.AddRow().AppendCollum(saveButton);

            #endregion SaveChannel Button
        }
Beispiel #9
0
        public ManualChannelPage(ChannelData channel, ManualPage parent) : base("div")
        {
            const int labelSize = 229;

            _channel = channel;
            SetBorder(BorderKind.Rounded, StylingColor.Secondary);

            #region ExecuteAction

            #region Initialize Grid

            Grid grid = new Grid(this);
            grid.AddStyling(StylingOption.MarginRight, 2);
            grid.AddStyling(StylingOption.MarginLeft, 2);
            grid.AddStyling(StylingOption.MarginTop, 4);
            grid.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Initialize Grid

            #region Init Container

            Container firstContainer = new Container();
            firstContainer.SetBorder(BorderKind.Rounded, StylingColor.Info);
            firstContainer.AddStyling(StylingOption.MarginTop, 3);
            firstContainer.AddStyling(StylingOption.MarginBottom, 1);
            firstContainer.AddStyling(StylingOption.PaddingTop, 3);
            firstContainer.AddStyling(StylingOption.PaddingBottom, 2);
            grid.AddRow().AppendCollum(firstContainer, autoSize: true);

            #endregion Init Container

            #region create Heading

            Heading firstHeading = new Heading(5, "Kanal aktivieren ...");
            firstContainer.AppendChild(firstHeading);

            #endregion create Heading

            #region duration Input

            MultiInputGroup durationMultiInputGroup = new MultiInputGroup();
            durationMultiInputGroup.AppendLabel("Dauer", labelSize);
            StylableTextInput durationTextInput = durationMultiInputGroup.AppendTextInput("hh:mm:ss");
            durationTextInput.Value = "00:00:00";
            firstContainer.AppendChild(durationMultiInputGroup);
            durationMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);
            durationMultiInputGroup.AppendValidation("", "Das Format der Dauer muss hh:mm:ss sein!", true);

            #endregion duration Input

            #region Master ButtonGroup

            MultiInputGroup masterEnabledMultiInputGroup = new MultiInputGroup();
            masterEnabledMultiInputGroup.AppendLabel("Master Aktivieren", labelSize);
            TwoStateButtonGroup masterEnabledTwoStateButtonGroup = masterEnabledMultiInputGroup.AppendCustomElement(new TwoStateButtonGroup("Ja", "Nein", true, false), false);
            firstContainer.AppendChild(masterEnabledMultiInputGroup);
            masterEnabledMultiInputGroup.AddStyling(StylingOption.MarginBottom, 2);

            #endregion Master ButtonGroup

            #region StartButton

            Button startButton = new Button(StylingColor.Success, true, text: "Einreihen!", fontAwesomeIcon: "plus-circle", asBlock: true);
            firstContainer.AppendChild(startButton);
            startButton.Click += (o, args) =>
            {
                if (durationTextInput.Value.Split(':').Length != 3 || durationTextInput.Value.Split(':').Any(s => int.TryParse(s, out _) == false))
                {
                    durationTextInput.SetValidation(false, true);
                }
                else
                {
                    durationTextInput.SetValidation(true, false);
                    startButton.IsDisabled = true;
                    try
                    {
                        CreateChannelAction(channel, TimeSpan.Parse(durationTextInput.Value), masterEnabledTwoStateButtonGroup.FirstButtonActive, 100);

                        startButton.Text = "Wurde Eingereiht";
                        Task.Run(() =>
                        {
                            System.Threading.Thread.Sleep(5000);
                            startButton.Text = "Einreihen!";
                            startButton.SetFontAwesomeIcon("plus-circle");
                            return(startButton.IsDisabled = false);
                        });
                    }
                    catch (Exception)
                    {
                        startButton.Text = "Einreihen fehlgeschlagen";
                        throw;
                    }
                }
            };
            firstContainer.AppendChild(startButton);
            startButton.AddStyling(StylingOption.MarginBottom, 2);

            #endregion StartButton

            #endregion ExecuteAction

            #region AddToBatch

            #region Init Container

            Container secondContainer = new Container();
            secondContainer.SetBorder(BorderKind.Rounded, StylingColor.Info);
            secondContainer.AddStyling(StylingOption.MarginTop, 3);
            secondContainer.AddStyling(StylingOption.MarginBottom, 1);
            secondContainer.AddStyling(StylingOption.PaddingTop, 3);
            secondContainer.AddStyling(StylingOption.PaddingBottom, 2);
            grid.AddRow().AppendCollum(secondContainer, autoSize: true);

            #endregion Init Container

            #region create Heading

            Heading heading = new Heading(5, "... als Batch-Auftrag speichern");
            secondContainer.AppendChild(heading);

            #endregion create Heading

            #region batchName Input

            MultiInputGroup batchNameMultiInputGroup = new MultiInputGroup();
            batchNameMultiInputGroup.AddStyling(StylingOption.MarginTop, 4);
            batchNameMultiInputGroup.AppendLabel("Name für den Batch-Auftrag:");
            StylableTextInput batchNameTextInput = batchNameMultiInputGroup.AppendTextInput("Name?");
            batchNameMultiInputGroup.AppendValidation("", "Der Name ist bereits vergeben", true);
            secondContainer.AppendChild(batchNameMultiInputGroup);

            #endregion batchName Input

            Button appendToBatchButton = new Button(StylingColor.Success, true, text: "Als Batch-Auftrag speichern", fontAwesomeIcon: "save", asBlock: true);
            appendToBatchButton.AddStyling(StylingOption.MarginTop, 2);
            appendToBatchButton.Click += (sender, args) =>
            {
                if (batchNameTextInput.Value == "")
                {
                    batchNameTextInput.SetValidation(false, true);
                    return;
                }
                if (PageStorage <ManualData> .Instance.StorageData.BatchEntries.Any(entry => entry.Name == batchNameTextInput.Value))
                {
                    batchNameTextInput.SetValidation(false, true);
                }
                else
                {
                    batchNameTextInput.SetValidation(true, false);
                    PageStorage <ManualData> .Instance.StorageData.BatchEntries.Add(new BatchEntry(batchNameTextInput.Value, channel.ChannelId, TimeSpan.Parse(durationTextInput.Value), masterEnabledTwoStateButtonGroup.FirstButtonActive, 100));

                    parent.UpdateBatch();
                }
            };
            secondContainer.AppendChild(appendToBatchButton);

            #endregion AddToBatch
        }