comparison ServerMonitor/Forms/CheckForm.cs @ 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 e59ec1585616
children
comparison
equal deleted inserted replaced
32:2342e9459444 33:69e8ecdbbdd3
146 TimeoutInput.Value = check.Timeout; 146 TimeoutInput.Value = check.Timeout;
147 SeverityComboBox.SelectedItem = check.FailStatus; 147 SeverityComboBox.SelectedItem = check.FailStatus;
148 FailuresInput.Value = check.MaxConsecutiveFailures; 148 FailuresInput.Value = check.MaxConsecutiveFailures;
149 FrequencyUnitsComboBox.SelectedItem = check.Schedule.Units; 149 FrequencyUnitsComboBox.SelectedItem = check.Schedule.Units;
150 FrequencyUpDown.Value = check.Schedule.Frequency; 150 FrequencyUpDown.Value = check.Schedule.Frequency;
151 StartTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.StartTime; 151 StartTimePicker.Value = AtTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.StartTime;
152 EndTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.EndTime; 152 EndTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.EndTime;
153 // Populate the controls specific to this check type. 153 // Populate the controls specific to this check type.
154 checkControl?.LoadCheck(check); 154 checkControl?.LoadCheck(check);
155 } 155 }
156 156
178 check.Name = NameTextBox.Text; 178 check.Name = NameTextBox.Text;
179 check.Enabled = EnabledCheckBox.Checked; 179 check.Enabled = EnabledCheckBox.Checked;
180 check.Timeout = (int)TimeoutInput.Value; 180 check.Timeout = (int)TimeoutInput.Value;
181 check.FailStatus = (CheckStatus)SeverityComboBox.SelectedItem; 181 check.FailStatus = (CheckStatus)SeverityComboBox.SelectedItem;
182 check.MaxConsecutiveFailures = (int)FailuresInput.Value; 182 check.MaxConsecutiveFailures = (int)FailuresInput.Value;
183 check.Schedule = new Schedule((FrequencyUnits)FrequencyUnitsComboBox.SelectedItem, (int)FrequencyUpDown.Value, StartTimePicker.Value.TimeOfDay, EndTimePicker.Value.TimeOfDay); 183 check.Schedule = new Schedule(
184 (FrequencyUnits)FrequencyUnitsComboBox.SelectedItem,
185 (int)FrequencyUpDown.Value,
186 (FrequencyUnits)FrequencyUnitsComboBox.SelectedItem == FrequencyUnits.Day ? AtTimePicker.Value.TimeOfDay : StartTimePicker.Value.TimeOfDay,
187 EndTimePicker.Value.TimeOfDay
188 );
184 // Attempt to update the check from the check control inputs. 189 // Attempt to update the check from the check control inputs.
185 try 190 try
186 { 191 {
187 checkControl?.UpdateCheck(check); 192 checkControl?.UpdateCheck(check);
188 // If the update succeeded, run the check's own validation. 193 // If the update succeeded, run the check's own validation.