comparison ServerMonitor/Forms/CheckForm.cs @ 1:9e92780ebc0f

Additional validation for SSH check
author Brad Greco <brad@bgreco.net>
date Tue, 01 Jan 2019 21:14:47 -0500
parents 3e1a2131f897
children 3142e52cbe69
comparison
equal deleted inserted replaced
0:3e1a2131f897 1:9e92780ebc0f
135 check.Server = server; 135 check.Server = server;
136 check.Name = NameTextBox.Text; 136 check.Name = NameTextBox.Text;
137 check.Enabled = EnabledCheckBox.Checked; 137 check.Enabled = EnabledCheckBox.Checked;
138 check.Timeout = (int)TimeoutInput.Value; 138 check.Timeout = (int)TimeoutInput.Value;
139 check.Schedule = new Schedule((FrequencyUnits)FrequencyUnitsComboBox.SelectedItem, (int)FrequencyUpDown.Value, StartTimePicker.Value.TimeOfDay, EndTimePicker.Value.TimeOfDay); 139 check.Schedule = new Schedule((FrequencyUnits)FrequencyUnitsComboBox.SelectedItem, (int)FrequencyUpDown.Value, StartTimePicker.Value.TimeOfDay, EndTimePicker.Value.TimeOfDay);
140 checkControl?.UpdateCheck(check); 140 try
141 result = check.Validate(saving); 141 {
142 checkControl?.UpdateCheck(check);
143 result = check.Validate(saving);
144 }
145 catch (UpdateCheckException e)
146 {
147 result = e.Message;
148 }
142 } 149 }
143 if (!result.IsNullOrEmpty()) 150 if (!result.IsNullOrEmpty())
144 { 151 {
145 MessageBox.Show(result, "Error validating check", MessageBoxButtons.OK, MessageBoxIcon.Error); 152 MessageBox.Show(result, "Error validating check", MessageBoxButtons.OK, MessageBoxIcon.Error);
146 return false; 153 return false;