/// <summary>Initializes a new instance of the <see cref="TriggerEditDialog"/> class.</summary> /// <param name="trigger">The <see cref="Trigger"/> to edit.</param> /// <param name="supportV1Only">If set to <c>true</c> support V1 triggers only.</param> /// <param name="allowedTriggers">Sets the types of triggers that can be edited. Default is all.</param> public TriggerEditDialog(Trigger trigger, bool supportV1Only = false, AvailableTriggers allowedTriggers = AvailableTriggers.AllTriggers) { InitializeComponent(); showCustom = trigger != null && trigger.TriggerType == TaskTriggerType.Custom; isV2 = !supportV1Only; // Populate combo boxes delaySpan.Items.AddRange(new[] { TimeSpan2.FromSeconds(30), TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(8), TimeSpan2.FromDays(1) }); repeatSpan.Items.AddRange(new[] { TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1) }); durationSpan.Items.AddRange(new[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1) }); durationSpan.FormattedZero = EditorProperties.Resources.TimeSpanIndefinitely; stopIfRunsSpan.Items.AddRange(new[] { TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2), TimeSpan2.FromHours(4), TimeSpan2.FromHours(8), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1), TimeSpan2.FromDays(3) }); AvailableTriggers = allowedTriggers; if (trigger != null) { Trigger = trigger; } else { Trigger = (AvailableTriggers & CalendarTriggerUI.calendarTriggers) != 0 ? GetFirstAvailableTrigger(CalendarTriggerUI.calendarTriggers) : GetFirstAvailableTrigger(); initialStartBoundary = DateTime.MinValue; } }
/// <summary> /// Initializes a new instance of the <see cref="TriggerEditDialog"/> class. /// </summary> /// <param name="trigger">The <see cref="Trigger"/> to edit.</param> /// <param name="supportV1Only">If set to <c>true</c> support V1 triggers only.</param> public TriggerEditDialog(Trigger trigger, bool supportV1Only) { InitializeComponent(); this.SupportV1Only = supportV1Only; // Populate combo boxes delaySpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromSeconds(30), TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(8), TimeSpan2.FromDays(1) }); repeatSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1) }); durationSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1) }); durationSpan.FormattedZero = EditorProperties.Resources.TimeSpanIndefinitely; stopIfRunsSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2), TimeSpan2.FromHours(4), TimeSpan2.FromHours(8), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1), TimeSpan2.FromDays(3) }); if (trigger != null) { this.Trigger = trigger; } else { this.Trigger = new TimeTrigger(); } }
/// <summary> /// Initializes a new instance of the <see cref="TriggerEditDialog"/> class. /// </summary> /// <param name="trigger">The <see cref="Trigger"/> to edit.</param> /// <param name="supportV1Only">If set to <c>true</c> support V1 triggers only.</param> public TriggerEditDialog(Trigger trigger, bool supportV1Only) { InitializeComponent(); showCustom = trigger != null && (trigger.TriggerType == TaskTriggerType.Custom); SupportV1Only = supportV1Only; // Populate combo boxes delaySpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromSeconds(30), TimeSpan2.FromMinutes(1), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(8), TimeSpan2.FromDays(1) }); repeatSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(5), TimeSpan2.FromMinutes(10), TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1) }); durationSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.Zero, TimeSpan2.FromMinutes(15), TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1) }); durationSpan.FormattedZero = EditorProperties.Resources.TimeSpanIndefinitely; stopIfRunsSpan.Items.AddRange(new TimeSpan2[] { TimeSpan2.FromMinutes(30), TimeSpan2.FromHours(1), TimeSpan2.FromHours(2), TimeSpan2.FromHours(4), TimeSpan2.FromHours(8), TimeSpan2.FromHours(12), TimeSpan2.FromDays(1), TimeSpan2.FromDays(3) }); if (trigger != null) { Trigger = trigger; } else { Trigger = new TimeTrigger(); initialStartBoundary = DateTime.MinValue; } }