private void button1_Click(object sender, EventArgs e)
        {
            if (isEditing)
            {
                timedCommandArray.RemoveCommandItem(editing);
                lstbox.Items.Remove(lstbox.SelectedItem);
            }

            List <string> list = new List <string>(
                textBox2.Text.Split(new string[] { "\r\n" },
                                    StringSplitOptions.RemoveEmptyEntries));
            TimedCommandItem cm = new TimedCommandItem(textBox1.Text, checkBox1.Checked, Decimal.ToInt32(numericUpDown2.Value), Decimal.ToInt32(numericUpDown1.Value), checkBox2.Checked, list);

            timedCommandArray.AddTimedCommand(cm);

            lstbox.Items.Add(new NewItem
            {
                Command = cm.GetName(),
                Cmd     = cm
            });

            SaveSettings();

            this.Close();
        }
        public TimedCommandForm(TimedCommandItem cmd, ListBox lsbx)
        {
            this.lstbox     = lsbx;
            FormBorderStyle = FormBorderStyle.FixedSingle;
            MaximizeBox     = false;

            isEditing = true;
            InitializeComponent();

            button1.Text = "Apply Edit";

            textBox1.Text        = cmd.GetName();
            numericUpDown2.Value = cmd.GetTime();
            checkBox1.Checked    = cmd.RunEveryXMin();
            numericUpDown1.Value = cmd.GetEveryXMin();

            for (int x = 0; x < cmd.GetCommands().Count(); x++)
            {
                textBox2.AppendText(cmd.GetCommands()[x] + System.Environment.NewLine);
            }
            editing = cmd;
        }