private void AddNewTrigger()
        {
            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,
                        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);
            }
        }
        private bool InputChanged()
        {
            int screenCaptureInterval = DataConvert.ConvertIntoMilliseconds((int)numericUpDownHoursInterval.Value,
                                                                            (int)numericUpDownMinutesInterval.Value, (int)numericUpDownSecondsInterval.Value,
                                                                            (int)numericUpDownMillisecondsInterval.Value);

            if (TriggerObject != null &&
                ((int)TriggerObject.ConditionType != listBoxCondition.SelectedIndex ||
                 (int)TriggerObject.ActionType != listBoxAction.SelectedIndex ||
                 (listBoxModuleItemList.Items.Count > 0 && TriggerObject.ModuleItem != null &&
                  listBoxModuleItemList.SelectedItem != null &&
                  !TriggerObject.ModuleItem.Equals(listBoxModuleItemList.SelectedItem.ToString())) ||
                 TriggerObject.Active != checkBoxActive.Checked ||
                 TriggerObject.Date != dateTimePickerDate.Value ||
                 TriggerObject.Time != dateTimePickerTime.Value ||
                 !TriggerObject.ScreenCaptureInterval.Equals(screenCaptureInterval)))
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
 /// <summary>
 /// Converts the string representation of a date into a DateTime object. Used by the RunDateSearch thread so we can set bolded dates in the calendar.
 /// </summary>
 /// <param name="date">A string representation of a date (such as "2019-02-06").</param>
 /// <returns>A DateTime object based on the provided date string.</returns>
 private DateTime ConvertDateStringToDateTime(string date)
 {
     return(DataConvert.ConvertDateStringToDateTime(date));
 }
 /// <summary>
 /// Converts the given hours, minutes, seconds, and milliseconds into an aggregate milliseconds value.
 /// </summary>
 /// <param name="hours">The number of hours to be converted.</param>
 /// <param name="minutes">The number of minutes to be converted.</param>
 /// <param name="seconds">The number of seconds to be converted.</param>
 /// <param name="milliseconds">The number of milliseconds to be converted.</param>
 /// <returns></returns>
 private int ConvertIntoMilliseconds(int hours, int minutes, int seconds, int milliseconds)
 {
     return(DataConvert.ConvertIntoMilliseconds(hours, minutes, seconds, milliseconds));
 }