changeset 33:69e8ecdbbdd3

Fix schedule time not being saved on daily schedules.
author Brad Greco <brad@bgreco.net>
date Sun, 16 Jun 2019 16:55:37 -0400
parents 2342e9459444
children 9c0e18d65e8b
files ServerMonitor/Forms/CheckForm.cs
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/ServerMonitor/Forms/CheckForm.cs	Sun Jun 16 16:55:14 2019 -0400
+++ b/ServerMonitor/Forms/CheckForm.cs	Sun Jun 16 16:55:37 2019 -0400
@@ -148,7 +148,7 @@
             FailuresInput.Value = check.MaxConsecutiveFailures;
             FrequencyUnitsComboBox.SelectedItem = check.Schedule.Units;
             FrequencyUpDown.Value = check.Schedule.Frequency;
-            StartTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.StartTime;
+            StartTimePicker.Value = AtTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.StartTime;
             EndTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.EndTime;
             // Populate the controls specific to this check type.
             checkControl?.LoadCheck(check);
@@ -180,7 +180,12 @@
                 check.Timeout = (int)TimeoutInput.Value;
                 check.FailStatus = (CheckStatus)SeverityComboBox.SelectedItem;
                 check.MaxConsecutiveFailures = (int)FailuresInput.Value;
-                check.Schedule = new Schedule((FrequencyUnits)FrequencyUnitsComboBox.SelectedItem, (int)FrequencyUpDown.Value, StartTimePicker.Value.TimeOfDay, EndTimePicker.Value.TimeOfDay);
+                check.Schedule = new Schedule(
+                    (FrequencyUnits)FrequencyUnitsComboBox.SelectedItem,
+                    (int)FrequencyUpDown.Value,
+                    (FrequencyUnits)FrequencyUnitsComboBox.SelectedItem == FrequencyUnits.Day ? AtTimePicker.Value.TimeOfDay : StartTimePicker.Value.TimeOfDay,
+                    EndTimePicker.Value.TimeOfDay
+                );
                 // Attempt to update the check from the check control inputs.
                 try
                 {