コード例 #1
0
        /// <summary>
        /// Applies the appropriate misfire handling policy.
        /// </summary>
        /// <param name="builder"></param>
        /// <param name="instruction"></param>
        void ApplyMisfireHandlingInstruction(SimpleScheduleBuilder builder, ScheduleMisfirePolicy instruction)
        {
            if (builder == null)
            {
                throw new ArgumentNullException(nameof(builder));
            }

            switch (instruction)
            {
            case ScheduleMisfirePolicy.Default:
                // apply no policy, use whatever is set by default
                break;

            case ScheduleMisfirePolicy.FireNow:
                builder.WithMisfireHandlingInstructionFireNow();
                break;

            case ScheduleMisfirePolicy.Ignore:
                builder.WithMisfireHandlingInstructionIgnoreMisfires();
                break;

            case ScheduleMisfirePolicy.NextWithExistingCount:
                builder.WithMisfireHandlingInstructionNextWithExistingCount();
                break;

            case ScheduleMisfirePolicy.NextWithRemainingCount:
                builder.WithMisfireHandlingInstructionNextWithRemainingCount();
                break;

            case ScheduleMisfirePolicy.NowWithExistingRepeatCount:
                builder.WithMisfireHandlingInstructionNowWithExistingCount();
                break;

            case ScheduleMisfirePolicy.NowWithRemainingRepeatCount:
                builder.WithMisfireHandlingInstructionNowWithRemainingCount();
                break;
            }
        }
コード例 #2
0
        public override IScheduleBuilder GetScheduleBuilder()
        {
            SimpleScheduleBuilder sb = SimpleScheduleBuilder.Create()
                                       .WithInterval(RepeatInterval)
                                       .WithRepeatCount(RepeatCount);

            switch (MisfireInstruction)
            {
            case Quartz.MisfireInstruction.SimpleTrigger.FireNow: sb.WithMisfireHandlingInstructionFireNow();
                break;

            case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNextWithExistingCount: sb.WithMisfireHandlingInstructionNextWithExistingCount();
                break;

            case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNextWithRemainingCount: sb.WithMisfireHandlingInstructionNextWithRemainingCount();
                break;

            case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNowWithExistingRepeatCount: sb.WithMisfireHandlingInstructionNowWithExistingCount();
                break;

            case Quartz.MisfireInstruction.SimpleTrigger.RescheduleNowWithRemainingRepeatCount: sb.WithMisfireHandlingInstructionNowWithRemainingCount();
                break;
            }

            return(sb);
        }