예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }