Example #1
0
        /// <summary>
        /// Create new CronExpression instance, which occurs monday to friday at specified hours
        /// </summary>
        /// <param name="hour">Hour, when occurence will happen</param>
        /// <param name="minute">Minute, when occurence will happen</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EveryWeekDayAt(int hour, int minute)
        {
            var ce = new CronExpression(hour, minute, CronExpressionType.EveryWeekDay);

            return(ce);
        }
Example #2
0
        /// <summary>
        /// Create new CronExpression instance, which occurs on specified days at specified hours
        /// </summary>
        /// <param name="hour">Hour, when occurence will happen</param>
        /// <param name="minute">Minute, when occurence will happen</param>
        /// <param name="days">Days, when occurence will happen</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EverySpecificWeekDayAt(int hour, int minute, DaysOfWeek days)
        {
            var ce = new CronExpression(days, hour, minute, CronExpressionType.EverySpecificWeekDayAt);

            return(ce);
        }
Example #3
0
        /// <summary>
        /// Create new CronExpression instance, which occurs every *hoursInterval* hours
        /// </summary>
        /// <param name="hoursInterval">Interval in hours</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EveryNHours(int hoursInterval)
        {
            var ce = new CronExpression(hoursInterval, CronExpressionType.EveryNHours);

            return(ce);
        }
Example #4
0
        /// <summary>
        /// Create new CronExpression instance, which occurs every *daysInterval* days at specified hours
        /// </summary>
        /// <param name="daysInterval">Interval in days</param>
        /// <param name="hour">Hour, when occurence will happen</param>
        /// <param name="minute">Minute, when occurence will happen</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EveryNDaysAt(int daysInterval, int hour, int minute)
        {
            var ce = new CronExpression(daysInterval, hour, minute, CronExpressionType.EveryNDaysAt);

            return(ce);
        }
 /// <summary>
 /// Create new CronExpression instance, which occurs every *hoursInterval* hours
 /// </summary>
 /// <param name="hoursInterval">Interval in hours</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EveryNHours(int hoursInterval)
 {
     var ce = new CronExpression(hoursInterval, CronExpressionType.EveryNHours);
     return ce;
 }
Example #6
0
        /// <summary>
        /// Create new CronExpression instance, which occurs every *minutesInteval* minutes
        /// </summary>
        /// <param name="minutesInteval">Interval in minutes</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EveryNMinutes(int minutesInteval)
        {
            var ce = new CronExpression(minutesInteval, CronExpressionType.EveryNMinutes);

            return(ce);
        }
 /// <summary>
 /// Create new CronExpression instance, which occurs on specified days at specified hours
 /// </summary>
 /// <param name="hour">Hour, when occurence will happen</param>
 /// <param name="minute">Minute, when occurence will happen</param>
 /// <param name="days">Days, when occurence will happen</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EverySpecificWeekDayAt(int hour, int minute, DaysOfWeek days)
 {
     var ce = new CronExpression(days, hour, minute, CronExpressionType.EverySpecificWeekDayAt);
     return ce;
 }
Example #8
0
        /// <summary>
        /// Create new CronExpression instance, which occurs on every first,
        /// second, third or fourth day of the week on specific month *month*
        /// at specified hours
        /// </summary>
        /// <param name="dayNumber">Day sequental number (first, second, third, fourth)</param>
        /// <param name="days">Day of week</param>
        /// <param name="month">Month</param>
        /// <param name="hour">Hour, when occurence will happen</param>
        /// <param name="minute">Minute, when occurence will happen</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EverySpecificSeqWeekDayOfMonthAt(DaySeqNumber dayNumber, DaysOfWeek days, Months month, int hour, int minute)
        {
            var ce = new CronExpression(dayNumber, days, month, hour, minute, CronExpressionType.EverySpecificSeqWeekDayOfMonthAt);

            return(ce);
        }
 /// <summary>
 /// Create new CronExpression instance, which occurs on every specific day *dayNumber* of 
 /// specific month *month* at specified hours
 /// </summary>
 /// <param name="month">Month</param>
 /// <param name="dayNumber">Day number</param>
 /// <param name="hour">Hour, when occurence will happen</param>
 /// <param name="minute">Minute, when occurence will happen</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EverySpecificDayOfMonthAt(Months month, int dayNumber, int hour, int minute)
 {
     var ce = new CronExpression(month, dayNumber, hour, minute, CronExpressionType.EverySpecificDayOfMonthAt);
     return ce;
 }
 /// <summary>
 /// Create new CronExpression instance, which occurs on every first, 
 /// second, third or fourth day of the week on specific month *month*
 /// at specified hours
 /// </summary>
 /// <param name="dayNumber">Day sequental number (first, second, third, fourth)</param>
 /// <param name="days">Day of week</param>
 /// <param name="month">Month</param>
 /// <param name="hour">Hour, when occurence will happen</param>
 /// <param name="minute">Minute, when occurence will happen</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EverySpecificSeqWeekDayOfMonthAt(DaySeqNumber dayNumber, DaysOfWeek days, Months month, int hour, int minute)
 {
     var ce = new CronExpression(dayNumber, days, month, hour, minute, CronExpressionType.EverySpecificSeqWeekDayOfMonthAt);
     return ce;
 }
 /// <summary>
 /// Create new CronExpression instance, which occurs every specific day of month 
 /// every *monthInterval* month at specified hours
 /// </summary>
 /// <param name="dayNumber">Day of the month, when occurence will happen</param>
 /// <param name="monthInterval">Interval in months</param>
 /// <param name="hour">Hour, when occurence will happen</param>
 /// <param name="minute">Minute, when occurence will happen</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EverySpecificDayEveryNMonthAt(int dayNumber, int monthInterval, int hour, int minute)
 {
     var ce = new CronExpression(dayNumber, monthInterval, hour, minute, CronExpressionType.EverySpecificDayEveryNMonthAt);
     return ce;
 }
 /// <summary>
 /// Create new CronExpression instance, which occurs every *secondsInteval* seconds
 /// </summary>
 /// <param name="secondsInteval">Interval in seconds</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EveryNSeconds(int secondsInteval)
 {
     var ce = new CronExpression(secondsInteval, CronExpressionType.EveryNSeconds);
     return ce;
 }
 /// <summary>
 /// Create new CronExpression instance, which occurs every *minutesInteval* minutes
 /// </summary>
 /// <param name="minutesInteval">Interval in minutes</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EveryNMinutes(int minutesInteval)
 {
     var ce = new CronExpression(minutesInteval, CronExpressionType.EveryNMinutes);
     return ce;
 }
Example #14
0
        /// <summary>
        /// Create new CronExpression instance, which occurs every specific day of month
        /// every *monthInterval* month at specified hours
        /// </summary>
        /// <param name="dayNumber">Day of the month, when occurence will happen</param>
        /// <param name="monthInterval">Interval in months</param>
        /// <param name="hour">Hour, when occurence will happen</param>
        /// <param name="minute">Minute, when occurence will happen</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EverySpecificDayEveryNMonthAt(int dayNumber, int monthInterval, int hour, int minute)
        {
            var ce = new CronExpression(dayNumber, monthInterval, hour, minute, CronExpressionType.EverySpecificDayEveryNMonthAt);

            return(ce);
        }
 /// <summary>
 /// Create new CronExpression instance, which occurs monday to friday at specified hours
 /// </summary>
 /// <param name="hour">Hour, when occurence will happen</param>
 /// <param name="minute">Minute, when occurence will happen</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EveryWeekDayAt(int hour, int minute)
 {
     var ce = new CronExpression(hour, minute, CronExpressionType.EveryWeekDay);
     return ce;
 }
Example #16
0
        /// <summary>
        /// Create new CronExpression instance, which occurs on every specific day *dayNumber* of
        /// specific month *month* at specified hours
        /// </summary>
        /// <param name="month">Month</param>
        /// <param name="dayNumber">Day number</param>
        /// <param name="hour">Hour, when occurence will happen</param>
        /// <param name="minute">Minute, when occurence will happen</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EverySpecificDayOfMonthAt(Months month, int dayNumber, int hour, int minute)
        {
            var ce = new CronExpression(month, dayNumber, hour, minute, CronExpressionType.EverySpecificDayOfMonthAt);

            return(ce);
        }
Example #17
0
        /// <summary>
        /// Create new CronExpression instance, which occurs every *secondsInteval* seconds
        /// </summary>
        /// <param name="secondsInteval">Interval in seconds</param>
        /// <returns>New CronExpression instance</returns>
        public static CronExpression EveryNSeconds(int secondsInteval)
        {
            var ce = new CronExpression(secondsInteval, CronExpressionType.EveryNSeconds);

            return(ce);
        }
        private void ButtonGenerate_Click(object sender, EventArgs e)
        {
            CronExpressionTextBox.Clear();

            if (InputTabControl.SelectedTab == InputTabControl.TabPages["MinutesPage"])
            {
                CronExpressionTextBox.Text = CronExpression.EveryNMinutes((int)MinutesUpDown.Value);
            }
            else if (InputTabControl.SelectedTab == InputTabControl.TabPages["HoursPage"])
            {
                if (HourlyRadioButton.Checked)
                {
                    CronExpressionTextBox.Text = CronExpression.EveryNHours((int)HoursUpDown.Value);
                }
                else if (AtTimeRadioButton.Checked)
                {
                    CronExpressionTextBox.Text = CronExpression.EveryDayAt(Convert.ToInt32(HoursComboBox1.SelectedItem),
                                                                           Convert.ToInt32(MinutesComboBox1.SelectedItem));
                }
            }
            else if (InputTabControl.SelectedTab == InputTabControl.TabPages["DaysPage"])
            {
                if (DailyRadioButton.Checked)
                {
                    CronExpressionTextBox.Text = CronExpression.EveryNDaysAt((int)DaysUpDown.Value,
                                                                             Convert.ToInt32(HoursComboBox2.SelectedItem),
                                                                             Convert.ToInt32(MinutesComboBox2.SelectedItem));
                }
                else if (EveryWeekDayRadioButton.Checked)
                {
                    CronExpressionTextBox.Text = CronExpression.EveryWeekDayAt(Convert.ToInt32(HoursComboBox2.SelectedItem),
                                                                               Convert.ToInt32(MinutesComboBox2.SelectedItem));
                }
            }
            else if (InputTabControl.SelectedTab == InputTabControl.TabPages["WeeksPage"])
            {
                int total = 0;
                if (MondayCheckBox.Checked)
                {
                    total += 1;
                }
                if (TuesdayCheckBox.Checked)
                {
                    total += 2;
                }
                if (WednesdayCheckBox.Checked)
                {
                    total += 4;
                }
                if (ThursdayCheckBox.Checked)
                {
                    total += 8;
                }
                if (FridayCheckBox.Checked)
                {
                    total += 16;
                }
                if (SaturdayCheckBox.Checked)
                {
                    total += 32;
                }
                if (SundayCheckBox.Checked)
                {
                    total += 64;
                }

                if (total == 0)
                {
                    ShowError("At least one day of the week is required.");
                }
                else
                {
                    CronExpressionTextBox.Text = CronExpression.EverySpecificWeekDayAt(Convert.ToInt32(HoursComboBox3.SelectedItem),
                                                                                       Convert.ToInt32(MinutesComboBox3.SelectedItem), (DaysOfWeek)total);
                }
            }
            else if (InputTabControl.SelectedTab == InputTabControl.TabPages["MonthsPage"])
            {
                if (DayRadioButton.Checked)
                {
                    CronExpressionTextBox.Text =
                        CronExpression.EverySpecificDayEveryNMonthAt(Convert.ToInt32(DayUpDown.Value),
                                                                     Convert.ToInt32(MonthUpDown.Value),
                                                                     Convert.ToInt32(HoursComboBox4.SelectedItem),
                                                                     Convert.ToInt32(MinutesComboBox4.SelectedItem));
                }
                else if (TheRadioButton.Checked)
                {
                    // Convert combo box index to enum (0 -> 1, 1 -> 2, 2 -> 4, etc)
                    var days = (DaysOfWeek)(Math.Pow(2, DayOfWeekComboBox.SelectedIndex));

                    // Convert combo box (first, second, third, fourth) to enum
                    var seqNumber = (DaySeqNumber)(SeqNumberComboBox.SelectedIndex + 1);

                    CronExpressionTextBox.Text =
                        CronExpression.EverySpecificSeqWeekDayEveryNMonthAt(seqNumber,
                                                                            days,
                                                                            Convert.ToInt32(MonthUpDown2.Value),
                                                                            Convert.ToInt32(HoursComboBox4.SelectedItem),
                                                                            Convert.ToInt32(MinutesComboBox4.SelectedItem));
                }
            }
            else if (InputTabControl.SelectedTab == InputTabControl.TabPages["YearsPage"])
            {
                if (EveryRadioButton.Checked)
                {
                    var month = (Months)(MonthComboBox.SelectedIndex + 1);

                    CronExpressionTextBox.Text =
                        CronExpression.EverySpecificDayOfMonthAt(month,
                                                                 Convert.ToInt32(DayOfMonthUpDown.Value),
                                                                 Convert.ToInt32(HoursComboBox5.SelectedItem),
                                                                 Convert.ToInt32(MinutesComboBox5.SelectedItem));
                }
                else if (TheRadioButton2.Checked)
                {
                    // Convert combo box index to enum (0 -> 1, 1 -> 2, 2 -> 4, etc)
                    var days = (DaysOfWeek)(Math.Pow(2, DayOfWeekComboBox2.SelectedIndex));

                    // Convert combo box (first, second, third, fourth) to enum
                    var seqNumber = (DaySeqNumber)(SeqNumberComboBox2.SelectedIndex + 1);

                    var month = (Months)(MonthComboBox2.SelectedIndex + 1);

                    CronExpressionTextBox.Text =
                        CronExpression.EverySpecificSeqWeekDayOfMonthAt(seqNumber,
                                                                        days,
                                                                        month,
                                                                        Convert.ToInt32(HoursComboBox5.SelectedItem),
                                                                        Convert.ToInt32(MinutesComboBox5.SelectedItem));
                }
            }
        }
 /// <summary>
 /// Create new CronExpression instance, which occurs every *daysInterval* days at specified hours
 /// </summary>
 /// <param name="daysInterval">Interval in days</param>
 /// <param name="hour">Hour, when occurence will happen</param>
 /// <param name="minute">Minute, when occurence will happen</param>
 /// <returns>New CronExpression instance</returns>
 public static CronExpression EveryNDaysAt(int daysInterval, int hour, int minute)
 {
     var ce = new CronExpression(daysInterval, hour, minute, CronExpressionType.EveryNDaysAt);
     return ce;
 }