Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
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);
            }
        }
Exemplo n.º 3
0
        private void ChangeTrigger()
        {
            if (InputValid())
            {
                TrimInput();

                if (TriggerCollection.GetByName(textBoxTriggerName.Text) != null && NameChanged())
                {
                    MessageBox.Show("A trigger with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }
                else
                {
                    TriggerCollection.Get(TriggerObject).Name          = textBoxTriggerName.Text;
                    TriggerCollection.Get(TriggerObject).ConditionType = (TriggerConditionType)listBoxCondition.SelectedIndex;
                    TriggerCollection.Get(TriggerObject).ActionType    = (TriggerActionType)listBoxAction.SelectedIndex;
                    TriggerCollection.Get(TriggerObject).Active        = checkBoxActive.Checked;
                    TriggerCollection.Get(TriggerObject).Date          = dateTimePickerDate.Value;
                    TriggerCollection.Get(TriggerObject).Time          = dateTimePickerTime.Value;
                    TriggerCollection.Get(TriggerObject).Day           = comboBoxDay.Text;
                    TriggerCollection.Get(TriggerObject).Days          = (int)numericUpDownDays.Value;

                    if (textBoxTriggerValue.Visible)
                    {
                        TriggerCollection.Get(TriggerObject).Value = textBoxTriggerValue.Text.Trim();
                    }
                    else
                    {
                        if (listBoxModuleItemList.SelectedItem != null)
                        {
                            TriggerCollection.Get(TriggerObject).Value = listBoxModuleItemList.SelectedItem.ToString();
                        }
                        else
                        {
                            TriggerCollection.Get(TriggerObject).Value = string.Empty;
                        }
                    }

                    int screenCaptureInterval = _dataConvert.ConvertIntoMilliseconds((int)numericUpDownHoursInterval.Value,
                                                                                     (int)numericUpDownMinutesInterval.Value, (int)numericUpDownSecondsInterval.Value,
                                                                                     (int)numericUpDownMillisecondsInterval.Value);

                    TriggerCollection.Get(TriggerObject).ScreenCaptureInterval = screenCaptureInterval;

                    Okay();
                }
            }
            else
            {
                MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 4
0
        private void ChangeTrigger()
        {
            if (InputValid())
            {
                if (NameChanged() || InputChanged())
                {
                    TrimInput();

                    if (TriggerCollection.GetByName(textBoxTriggerName.Text) != null && NameChanged())
                    {
                        MessageBox.Show("A trigger with this name already exists.", "Duplicate Name Conflict", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                    else
                    {
                        TriggerCollection.Get(TriggerObject).Name          = textBoxTriggerName.Text;
                        TriggerCollection.Get(TriggerObject).ConditionType = (TriggerConditionType)listBoxCondition.SelectedIndex;
                        TriggerCollection.Get(TriggerObject).ActionType    = (TriggerActionType)listBoxAction.SelectedIndex;
                        TriggerCollection.Get(TriggerObject).Active        = checkBoxActive.Checked;
                        TriggerCollection.Get(TriggerObject).Date          = dateTimePickerDate.Value;
                        TriggerCollection.Get(TriggerObject).Time          = dateTimePickerTime.Value;

                        if (listBoxEditor.Enabled)
                        {
                            TriggerCollection.Get(TriggerObject).Editor = listBoxEditor.SelectedItem.ToString();
                        }
                        else
                        {
                            TriggerCollection.Get(TriggerObject).Editor = string.Empty;
                        }

                        Okay();
                    }
                }
                else
                {
                    Close();
                }
            }
            else
            {
                MessageBox.Show("Please enter valid input for each field.", "Invalid Input", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 5
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,
                        ModuleItem            = 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);
            }
        }