public void Apply(TriggerBuilder builder, TriggerPropertiesViewModel model) { builder.WithCalendarIntervalSchedule(x => { if (!string.IsNullOrEmpty(TimeZone)) { x.InTimeZone(TimeZoneInfo.FindSystemTimeZoneById(TimeZone)); } x.WithInterval(RepeatInterval.Value, RepeatUnit); x.PreserveHourOfDayAcrossDaylightSavings(PreserveHourAcrossDst); x.SkipDayIfHourDoesNotExist(SkipDayIfHourDoesNotExist); switch (model.MisfireInstruction) { case InstructionNotSet: break; case IgnoreMisfirePolicy: x.WithMisfireHandlingInstructionIgnoreMisfires(); break; case CalendarIntervalTrigger.DoNothing: x.WithMisfireHandlingInstructionDoNothing(); break; case CalendarIntervalTrigger.FireOnceNow: x.WithMisfireHandlingInstructionFireAndProceed(); break; default: throw new ArgumentException("Invalid value: " + model.MisfireInstruction, nameof(model.MisfireInstruction)); } }); }