Exemplo n.º 1
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;
            }
        }
Exemplo n.º 2
0
 public void RemoveChannel(ChannelPage channelPage, ChannelData channel)
 {
     _channelsData.StorageData.Channels.Remove(channel);
     _pillNavigation.RemovePill(channel.Name, channelPage);
 }