Example #1
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();
        }