示例#1
0
        public ChannelsPage(PageStorage <ChannelsData> channelsData) : base("div")
        {
            _channelsData = channelsData;

            Row row = new Row();

            AppendChild(row);

            Button addChannel = new Button(asOutline: true, size: Button.ButtonSize.Small);

            addChannel.Click += (sender, args) =>
            {
                ChannelData channelData = ChannelData.CreateNew((channelsData.StorageData.Channels.Count > 0 ? channelsData.StorageData.Channels.Max(data => data.ChannelId) : 0) + 1);
                channelsData.StorageData.Channels.Add(channelData);
                AddChannel(channelData.Name, channelData, false);
            };
            addChannel.Text = "Neuen Kanal hinzufügen";
            addChannel.AddStyling(StylingOption.MarginTop, 2);

            AddChannel("Master", channelsData.StorageData.MasterChannel, true);

            foreach (ChannelData channel in channelsData.StorageData.Channels)
            {
                AddChannel(channel.Name, channel, false);
                ApplyName(channel);
            }

            AppendChild(_pillNavigation);
            AppendChild(addChannel);
        }
示例#2
0
        public OverviewPage() : base("div")
        {
            Container wrappingContainer = new Container();
            Grid      grid = new Grid(wrappingContainer);

            grid.AddRow().AppendCollum(new Heading(2, "Automatische Aufträge")
            {
                ClassName = "text-center"
            });

            Table <string> automaticTable = new Table <string>(CreateAutomaticTableHeading(), CreateAutomaticTableBody(), value => value, 4);

            grid.AddRow().AppendCollum(automaticTable);

            grid.AddRow().AppendCollum(new Heading(2, "Manuelle Aufträge")
            {
                ClassName = "text-center"
            });

            Table <string> manualTable = new Table <string>(CreateManualTableHeading(), CreateManualTableBody(), value => value, 5);

            manualTable.SetButtonColumn("Löschen", s =>
            {
                Button button = new Button(StylingColor.Danger, true, Button.ButtonSize.Small, fontAwesomeIcon: "trash");
                button.Click += (sender, args) =>
                {
                    button.IsDisabled = true;
                    ServerConnection.DeleteAsync($"overview", $"deleteManualEntry?number={s}").ContinueWith(task => button.SetToolTip(ToolTipLocation.Top, "Gelöscht"));
                };
                return(button);
            });
            grid.AddRow().AppendCollum(manualTable);
            AppendChild(wrappingContainer);
        }
示例#3
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);
        }
示例#4
0
        public Dropdown(Button button, DropdownDirection dropdownDirection = DropdownDirection.DropDown, bool asSplitButton = false) : base("div")
        {
            Button = button;
            switch (dropdownDirection)
            {
            case DropdownDirection.DropDown:
                ClassName = "dropdown";
                break;

            case DropdownDirection.DropUp:
                ClassName = "btn-group dropup";
                break;

            case DropdownDirection.DropRight:
                ClassName = "btn-group dropright";
                break;

            case DropdownDirection.DropLeft:
                ClassName = "btn-group dropleft";
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(dropdownDirection), dropdownDirection, null);
            }

            if (asSplitButton)
            {
                SplitButton = new Button()
                {
                    ClassName = button.ClassName + "dropdown-toggle dropdown-toggle-split"
                };
                SplitButton.SetAttribute("data-toggle", "dropdown");
                SplitButton.SetAttribute("aria-haspopup", "true");
                SplitButton.SetAttribute("aria-expanded", "false");
                AppendChild(button);
                AppendChild(SplitButton);
            }
            else
            {
                button.ClassName += " dropdown-toggle";
                button.SetAttribute("data-toggle", "dropdown");
                button.SetAttribute("aria-haspopup", "true");
                button.SetAttribute("aria-expanded", "false");
                AppendChild(button);
            }

            _dropDownMenu = new Div()
            {
                ClassName = "dropdown-menu"
            };
            AppendChild(_dropDownMenu);
        }
示例#5
0
文件: Loading.cs 项目: TabNoc/PiWeb
        public void ShowError(Exception exception, string msg)
        {
            _progressBarDiv.ClassName += " bg-danger";
            _loadingText.Text          = msg;

            Div footer = new Div
            {
                ClassName = "modal-footer"
            };

            contentWrapper.AppendChild(footer);

            TextInputGroup inputGroup = new TextInputGroup("", "Passwort", inValidFeedback: "Falsches Passwort", centeredText: true)
            {
                IsHidden = true
            };
            Button button = new Button(StylingColor.Info, true, text: "Infos anzeigen");

            button.Click += (sender, args) =>
            {
                if (inputGroup.IsHidden == true)
                {
                    inputGroup.IsHidden = false;
                }
                else
                {
                    if (inputGroup.TextInput.Value == "huhu")
                    {
                        Span span = new Span(exception.ToString());
                        footer.AppendChild(span);
                        footer.RemoveChild(inputGroup);
                        footer.RemoveChild(button);
                    }
                    else
                    {
                        inputGroup.TextInput.SetValidation(false, true);
                    }
                }
            };

            footer.AppendChild(inputGroup);
            footer.AppendChild(button);
        }
示例#6
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
        }
示例#7
0
文件: JobPage.cs 项目: TabNoc/PiWeb
        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()}"
                });
            }
        }
示例#8
0
        public HistoryPage() : base("div")
        {
            AddStyling(StylingOption.MarginRight, 5);
            AddStyling(StylingOption.MarginLeft, 5);
            AddStyling(StylingOption.PaddingRight, 5);
            AddStyling(StylingOption.PaddingLeft, 5);
            //Container wrappingContainer = new Container(this);
            Grid grid = new Grid(this);

            Dropdown messageKindDropdown = new Dropdown(new Button(StylingColor.Light, false, text: "Quelle auswählen!"));
            Row      headerRow           = new Grid(grid.AddRow()).AddRow();

            headerRow.AppendCollum(messageKindDropdown, 6);
            messageKindDropdown.AddStyling(StylingOption.MarginBottom, 4);

            // Table historyTable = new Table(new List<string>() { "Zeitpunkt", "Status", "Quelle", "Meldung" }, CreateHistoryTableContent(), true);
            Table <DateTime> historyTable = new Table <DateTime>(new List <string>()
            {
                "Zeitpunkt", "Status", "Quelle", "Meldung"
            }, FetchEntries, FetchSearchEntries, FetchAmount, PrimaryCellConverter, true, 14);

            grid.AddRow().AppendCollum(historyTable);

            messageKindDropdown.AddEntry("Alles").Click += (sender, args) =>
            {
                historyTable.SetFilter("", "", true);
                messageKindDropdown.Button.Text = "Alles anzeigen";
            };
            messageKindDropdown.AddDivider();
            messageKindDropdown.AddEntry("System").Click += (sender, args) =>
            {
                historyTable.SetFilter("Quelle", "System", true);
                messageKindDropdown.Button.Text = "System-Meldungen anzeigen";
            };
            messageKindDropdown.AddEntry("Automatikbetrieb").Click += (sender, args) =>
            {
                historyTable.SetFilter("Quelle", "Automatic", true);
                messageKindDropdown.Button.Text = "Automatikbetrieb-Meldungen anzeigen";
            };
            messageKindDropdown.AddEntry("Handbetrieb").Click += (sender, args) =>
            {
                historyTable.SetFilter("Quelle", "Manual", true);
                messageKindDropdown.Button.Text = "Handbetrieb-Meldungen anzeigen";
            };

            historyTable.SetCellValueColor("Status", "OK", StylingColor.Success);
            historyTable.SetCellValueColor("Status", "Warn", StylingColor.Warning);
            historyTable.SetCellValueColor("Status", "Warnung", StylingColor.Warning);
            historyTable.SetCellValueColor("Status", "Error", StylingColor.Danger);
            historyTable.SetCellValueColor("Status", "Fehler", StylingColor.Danger);

            Button refreshButton = headerRow.AppendCollum(new Button(StylingColor.Primary, true, Button.ButtonSize.Normal, false, "Inhalt Aktualisieren! "), 2, false);

            refreshButton.Click += (sender, args) =>
            {
                refreshButton.IsDisabled = true;
                historyTable.RefreshBeginningTableContent();
                refreshButton.IsDisabled = false;
                if (refreshButton.Text.Contains(" !"))
                {
                    refreshButton.Text = refreshButton.Text.Replace(" !", "! ");
                }
                else
                {
                    refreshButton.Text = refreshButton.Text.TrimEnd(' ', '!') + " !";
                }
            };

            historyTable.EndUpdate();
        }
示例#9
0
文件: BatchPage.cs 项目: TabNoc/PiWeb
        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
        }
示例#10
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
        }
示例#11
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
        }