예제 #1
0
        private void AddNewTrigger()
        {
            if (InputValid())
            {
                TrimInput();

                if (TriggerCollection.GetByName(textBoxTriggerName.Text) == null)
                {
                    TriggerCollection.Add(new Trigger(textBoxTriggerName.Text,
                                                      (TriggerConditionType)comboBoxCondition.SelectedIndex,
                                                      (TriggerActionType)comboBoxAction.SelectedIndex,
                                                      comboBoxEditor.Enabled ? comboBoxEditor.SelectedItem.ToString() : string.Empty));

                    Okay();
                }
                else
                {
                    MessageBox.Show("A trigger 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);
            }
        }
예제 #2
0
        private void AddNewTrigger()
        {
            if (InputValid())
            {
                TrimInput();

                if (TriggerCollection.GetByName(textBoxTriggerName.Text) == null)
                {
                    Trigger trigger = new Trigger()
                    {
                        Name          = textBoxTriggerName.Text,
                        ConditionType = (TriggerConditionType)listBoxCondition.SelectedIndex,
                        ActionType    = (TriggerActionType)listBoxAction.SelectedIndex,
                        Editor        = listBoxEditor.SelectedItem.ToString(),
                        Active        = checkBoxActive.Checked,
                        Date          = dateTimePickerDate.Value,
                        Time          = dateTimePickerTime.Value
                    };

                    TriggerCollection.Add(trigger);

                    Okay();
                }
                else
                {
                    MessageBox.Show("A trigger 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);
            }
        }
예제 #3
0
        private void AddTrigger()
        {
            if (InputValid())
            {
                TrimInput();

                if (TriggerCollection.GetByName(textBoxTriggerName.Text) == null)
                {
                    int screenCaptureInterval = _dataConvert.ConvertIntoMilliseconds((int)numericUpDownHoursInterval.Value,
                                                                                     (int)numericUpDownMinutesInterval.Value, (int)numericUpDownSecondsInterval.Value,
                                                                                     (int)numericUpDownMillisecondsInterval.Value);

                    Trigger trigger = new Trigger()
                    {
                        Name                  = textBoxTriggerName.Text,
                        ConditionType         = (TriggerConditionType)listBoxCondition.SelectedIndex,
                        ActionType            = (TriggerActionType)listBoxAction.SelectedIndex,
                        Active                = checkBoxActive.Checked,
                        Date                  = dateTimePickerDate.Value,
                        Time                  = dateTimePickerTime.Value,
                        Day                   = comboBoxDay.Text,
                        Days                  = (int)numericUpDownDays.Value,
                        ScreenCaptureInterval = screenCaptureInterval
                    };

                    if (textBoxTriggerValue.Visible)
                    {
                        trigger.Value = textBoxTriggerValue.Text.Trim();
                    }
                    else
                    {
                        trigger.Value = listBoxModuleItemList.SelectedItem != null?listBoxModuleItemList.SelectedItem.ToString() : string.Empty;
                    }

                    TriggerCollection.Add(trigger);

                    Okay();
                }
                else
                {
                    MessageBox.Show("A trigger 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);
            }
        }