private void ChangeTag() { if (InputValid()) { if (NameChanged() || InputChanged()) { TrimInput(); if (TagCollection.GetByName(textBoxName.Text) != null && NameChanged()) { MessageBox.Show("A tag with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { TagCollection.Get(TagObject).Name = textBoxName.Text; TagCollection.Get(TagObject).Description = textBoxDescription.Text; TagCollection.Get(TagObject).Type = (TagType)comboBoxType.SelectedIndex; TagCollection.Get(TagObject).DateTimeFormatValue = textBoxDateTimeFormatValue.Text; TagCollection.Get(TagObject).TimeRangeMacro1Start = dateTimePickerMacro1Start.Value; TagCollection.Get(TagObject).TimeRangeMacro1End = dateTimePickerMacro1End.Value; TagCollection.Get(TagObject).TimeRangeMacro1Macro = textBoxMacro1Macro.Text; TagCollection.Get(TagObject).TimeRangeMacro2Start = dateTimePickerMacro2Start.Value; TagCollection.Get(TagObject).TimeRangeMacro2End = dateTimePickerMacro2End.Value; TagCollection.Get(TagObject).TimeRangeMacro2Macro = textBoxMacro2Macro.Text; TagCollection.Get(TagObject).TimeRangeMacro3Start = dateTimePickerMacro3Start.Value; TagCollection.Get(TagObject).TimeRangeMacro3End = dateTimePickerMacro3End.Value; TagCollection.Get(TagObject).TimeRangeMacro3Macro = textBoxMacro3Macro.Text; TagCollection.Get(TagObject).TimeRangeMacro4Start = dateTimePickerMacro4Start.Value; TagCollection.Get(TagObject).TimeRangeMacro4End = dateTimePickerMacro4End.Value; TagCollection.Get(TagObject).TimeRangeMacro4Macro = textBoxMacro4Macro.Text; TagCollection.Get(TagObject).Active = checkBoxActive.Checked; TagCollection.Get(TagObject).Notes = textBoxNotes.Text; Okay(); } } else { Close(); } } else { MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void ChangeTag() { if (InputValid()) { if (NameChanged() || InputChanged()) { TrimInput(); if (TagCollection.GetByName(textBoxName.Text) != null && NameChanged()) { MessageBox.Show("A tag with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { TagCollection.Get(TagObject).Name = textBoxName.Text; TagCollection.Get(TagObject).Description = textBoxDescription.Text; TagCollection.Get(TagObject).Type = (TagType)comboBoxType.SelectedIndex; TagCollection.Get(TagObject).DateTimeFormatValue = textBoxDateTimeFormatValue.Text; TagCollection.Get(TagObject).TimeOfDayMorningStart = dateTimePickerMorningStart.Value; TagCollection.Get(TagObject).TimeOfDayMorningEnd = dateTimePickerMorningEnd.Value; TagCollection.Get(TagObject).TimeOfDayMorningValue = textBoxMorningValue.Text; TagCollection.Get(TagObject).TimeOfDayAfternoonStart = dateTimePickerAfternoonStart.Value; TagCollection.Get(TagObject).TimeOfDayAfternoonEnd = dateTimePickerAfternoonEnd.Value; TagCollection.Get(TagObject).TimeOfDayAfternoonValue = textBoxAfternoonValue.Text; TagCollection.Get(TagObject).TimeOfDayEveningStart = dateTimePickerEveningStart.Value; TagCollection.Get(TagObject).TimeOfDayEveningEnd = dateTimePickerEveningEnd.Value; TagCollection.Get(TagObject).TimeOfDayEveningValue = textBoxEveningValue.Text; TagCollection.Get(TagObject).EveningExtendsToNextMorning = checkBoxEveningExtendsToNextMorning.Checked; TagCollection.Get(TagObject).Active = checkBoxActive.Checked; TagCollection.Get(TagObject).Notes = textBoxNotes.Text; Okay(); } } else { Close(); } } else { MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void AddNewTag() { if (InputValid()) { TrimInput(); if (TagCollection.GetByName(textBoxName.Text) == null) { TagCollection.Add(new Tag(textBoxName.Text, textBoxDescription.Text, (TagType)comboBoxType.SelectedIndex, textBoxDateTimeFormatValue.Text, dateTimePickerMacro1Start.Value, dateTimePickerMacro1End.Value, textBoxMacro1Macro.Text, dateTimePickerMacro2Start.Value, dateTimePickerMacro2End.Value, textBoxMacro2Macro.Text, dateTimePickerMacro3Start.Value, dateTimePickerMacro3End.Value, textBoxMacro3Macro.Text, dateTimePickerMacro4Start.Value, dateTimePickerMacro4End.Value, textBoxMacro4Macro.Text, checkBoxActive.Checked, textBoxNotes.Text )); Okay(); } else { MessageBox.Show("A tag with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning); } } else { MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void listBoxMacroTags_SelectedIndexChanged(object sender, System.EventArgs e) { Tag tag = _tagCollection.GetByName((string)listBoxMacroTags.SelectedItem); labelHelp.Text = MacroParser.ParseTags(tag.Description, _tagCollection); }