Example #1
0
        private void cbType_SelectedIndexChanged(object sender, EventArgs e)
        {
            string s = cbType.Text;

            if (!string.IsNullOrEmpty(s))
            {
                EnumScheduleType type = (EnumScheduleType)Enum.Parse(typeof(EnumScheduleType), s);
                arrangeUI(type);
            }
        }
Example #2
0
        private void arrangeUI(EnumScheduleType type)
        {
            textBoxMax.Enabled = (type != EnumScheduleType.SpecificTime);
            if (type != EnumScheduleType.SpecificTime)
            {
            }
            if (type == EnumScheduleType.Monthly)
            {
                textBoxInterval.MinimumValue = 1;
                textBoxInterval.MaximumValue = 31;
                if (textBoxInterval.ValueInt64 > 31)
                {
                    textBoxInterval.Text         = "1";
                    textBoxInterval.NumericValue = 1;
                }
            }
            else
            {
                textBoxInterval.MinimumValue = 0;
                textBoxInterval.MaximumValue = 0;
            }
            switch (type)
            {
            case EnumScheduleType.InMilliseconds:
                groupBoxSpecific.Visible  = false;
                groupBoxInterval.Visible  = true;
                groupBox1.Visible         = true;
                groupBoxMinutes.Visible   = false;
                groupBoxSpecific.Visible  = false;
                groupBoxWeekLy.Visible    = false;
                groupBoxYear.Visible      = false;
                labelInterval.Text        = "Interval:";
                labelIntervalUnit.Text    = "milliseconds";
                labelIntervalUnit.Visible = true;
                break;

            case EnumScheduleType.InSeconds:
                groupBoxSpecific.Visible  = false;
                groupBoxInterval.Visible  = true;
                groupBox1.Visible         = true;
                groupBoxMinutes.Visible   = false;
                groupBoxSpecific.Visible  = false;
                groupBoxWeekLy.Visible    = false;
                groupBoxYear.Visible      = false;
                labelInterval.Text        = "Interval:";
                labelIntervalUnit.Text    = "seconds";
                labelIntervalUnit.Visible = true;
                break;

            case EnumScheduleType.InMinutes:
                groupBoxSpecific.Visible  = false;
                groupBoxInterval.Visible  = true;
                groupBox1.Visible         = true;
                groupBoxMinutes.Visible   = true;
                groupBoxSpecific.Visible  = false;
                groupBoxWeekLy.Visible    = false;
                groupBoxYear.Visible      = false;
                labelInterval.Text        = "Interval:";
                labelIntervalUnit.Text    = "minutes";
                labelIntervalUnit.Visible = true;
                textBoxMinute.Visible     = false;
                labelMinute.Visible       = false;
                textBoxHour.Visible       = false;
                labelHour.Visible         = false;
                break;

            case EnumScheduleType.InHours:
                groupBoxSpecific.Visible  = false;
                groupBoxInterval.Visible  = true;
                groupBox1.Visible         = true;
                groupBoxMinutes.Visible   = true;
                groupBoxSpecific.Visible  = false;
                groupBoxWeekLy.Visible    = false;
                groupBoxYear.Visible      = false;
                labelInterval.Text        = "Interval:";
                labelIntervalUnit.Text    = "hours";
                labelIntervalUnit.Visible = true;
                textBoxMinute.Visible     = true;
                labelMinute.Visible       = true;
                textBoxHour.Visible       = false;
                labelHour.Visible         = false;
                break;

            case EnumScheduleType.Daily:
                groupBoxSpecific.Visible = false;
                groupBoxInterval.Visible = false;
                groupBox1.Visible        = true;
                groupBoxMinutes.Visible  = true;
                groupBoxSpecific.Visible = false;
                groupBoxWeekLy.Visible   = false;
                groupBoxYear.Visible     = false;
                textBoxMinute.Visible    = true;
                labelMinute.Visible      = true;
                textBoxHour.Visible      = true;
                labelHour.Visible        = true;
                break;

            case EnumScheduleType.Weekly:
                groupBoxSpecific.Visible = false;
                groupBoxInterval.Visible = false;
                groupBox1.Visible        = true;
                groupBoxMinutes.Visible  = true;
                groupBoxSpecific.Visible = false;
                groupBoxWeekLy.Visible   = true;
                groupBoxYear.Visible     = false;
                textBoxMinute.Visible    = true;
                labelMinute.Visible      = true;
                textBoxHour.Visible      = true;
                labelHour.Visible        = true;
                break;

            case EnumScheduleType.Monthly:
                groupBoxSpecific.Visible     = false;
                groupBoxInterval.Visible     = true;
                groupBox1.Visible            = true;
                groupBoxMinutes.Visible      = true;
                groupBoxSpecific.Visible     = false;
                groupBoxWeekLy.Visible       = false;
                groupBoxYear.Visible         = false;
                textBoxMinute.Visible        = true;
                labelMinute.Visible          = true;
                textBoxHour.Visible          = true;
                labelHour.Visible            = true;
                labelInterval.Text           = "Month day:";
                labelIntervalUnit.Visible    = false;
                textBoxInterval.MinimumValue = 1;
                textBoxInterval.MaximumValue = 31;
                break;

            case EnumScheduleType.Yearly:
                groupBoxSpecific.Visible = false;
                groupBoxInterval.Visible = false;
                groupBox1.Visible        = true;
                groupBoxMinutes.Visible  = true;
                groupBoxSpecific.Visible = false;
                groupBoxWeekLy.Visible   = false;
                groupBoxYear.Visible     = true;
                textBoxMinute.Visible    = true;
                labelMinute.Visible      = true;
                textBoxHour.Visible      = true;
                labelHour.Visible        = true;
                break;

            case EnumScheduleType.SpecificTime:
                groupBox1.Visible        = false;
                groupBoxSpecific.Visible = true;
                textBoxMax.Text          = "1";
                break;
            }
        }