Esempio n. 1
0
 public ScheduleDef(string minute, string hour, string dayOfMonth, string month, string dayOfWeek)
 {
     m_minute     = ScheduleArray.Parse(minute, 0, 59);
     m_hour       = ScheduleArray.Parse(hour, 0, 23);
     m_dayOfMonth = ScheduleArray.Parse(dayOfMonth, 1, 31);
     m_month      = ScheduleArray.Parse(month, 1, 12);
     m_dayOfWeek  = ScheduleArray.Parse(dayOfWeek, 0, 6);
 }
Esempio n. 2
0
        private void button3_Click(object sender, EventArgs e)
        {
            var ar = ScheduleArray.Parse(tbxDayOfMonth.Text, 1, 31);

            ar = ScheduleArrayForm.Run(4, 10, 31, null, 1, false, ar);
            if (ar != null)
            {
                tbxDayOfMonth.Text = ar.ToString();
            }
        }
Esempio n. 3
0
        private void button2_Click(object sender, EventArgs e)
        {
            var ar = ScheduleArray.Parse(tbxHour.Text, 0, 23);

            ar = ScheduleArrayForm.Run(2, 12, 24, null, 0, false, ar);
            if (ar != null)
            {
                tbxHour.Text = ar.ToString();
            }
        }
Esempio n. 4
0
        private void button1_Click(object sender, EventArgs e)
        {
            var ar = ScheduleArray.Parse(tbxMinute.Text, 0, 59);

            ar = ScheduleArrayForm.Run(6, 10, 60, null, 0, true, ar);
            if (ar != null)
            {
                tbxMinute.Text = ar.ToString();
            }
        }
Esempio n. 5
0
        private void button4_Click(object sender, EventArgs e)
        {
            var ar       = ScheduleArray.Parse(tbxDayOfWeek.Text, 0, 6);
            var WEEKDAYS = new string[] { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };

            ar = ScheduleArrayForm.Run(1, 7, 7, WEEKDAYS, 0, false, ar);
            if (ar != null)
            {
                tbxDayOfWeek.Text = ar.ToString();
            }
        }
Esempio n. 6
0
        private void button5_Click(object sender, EventArgs e)
        {
            var ar     = ScheduleArray.Parse(tbxMonth.Text, 1, 12);
            var MONTHS = new string[] { "Jab", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Now", "Dec" };

            ar = ScheduleArrayForm.Run(2, 6, 12, MONTHS, 1, false, ar);
            if (ar != null)
            {
                tbxMonth.Text = ar.ToString();
            }
        }
Esempio n. 7
0
        public static ScheduleArray Parse(string s, int min, int max)
        {
            var res = new ScheduleArray(min, max);

            if (s == "*")
            {
                for (int i = min; i <= max; i++)
                {
                    res.m_items.Add(i);
                }
                return(res);
            }
            if (s == "?" || String.IsNullOrEmpty(s))
            {
                return(res);
            }
            foreach (string item in s.Split(','))
            {
                string it2 = item.Trim();
                if (it2.Contains("-"))
                {
                    string[] bounds = it2.Split('-');
                    int      low    = Int32.Parse(bounds[0].Trim());
                    int      high   = Int32.Parse(bounds[1].Trim());
                    for (int i = low; i <= high; i++)
                    {
                        res.m_items.Add(i);
                    }
                }
                else
                {
                    res.m_items.Add(Int32.Parse(it2));
                }
            }
            return(res);
        }
Esempio n. 8
0
        public static ScheduleArray Run(int rows, int cols, int itemCount, string[] items, int offset, bool every, ScheduleArray initValue)
        {
            var win = new ScheduleArrayForm(rows, cols, itemCount, items, offset, every, initValue);

            if (win.ShowDialogEx() == DialogResult.OK)
            {
                return(win.CheckedItems);
            }
            return(null);
        }
Esempio n. 9
0
 public ScheduleArrayForm(int rows, int cols, int itemCount, string[] items, int offset, bool every, ScheduleArray initValue)
 {
     InitializeComponent();
     Height     += rows * btnOk.Height;
     m_items     = items;
     m_offset    = offset;
     m_itemCount = itemCount;
     for (int i = 0; i < itemCount; i++)
     {
         var chb = new CheckBox();
         chb.Text = (m_items != null ? m_items[i] : (i + m_offset).ToString());
         m_checkBoxes.Add(chb);
         panel1.Controls.Add(chb);
         chb.Left     = panel1.Width / cols * (i % cols);
         chb.Top      = panel1.Height / rows * (i / cols);
         chb.AutoSize = true;
     }
     btnEvery10.Visible = btnEvery15.Visible = btnEvery5.Visible = every;
     foreach (int i in initValue.Items)
     {
         m_checkBoxes[i - m_offset].Checked = true;
     }
 }