comparison ServerMonitor/Forms/CheckForm.cs @ 4:3142e52cbe69

Lots more progress
author Brad Greco <brad@bgreco.net>
date Sun, 10 Feb 2019 20:51:26 -0500
parents 9e92780ebc0f
children 052aa62cb42a
comparison
equal deleted inserted replaced
3:96f0b028176d 4:3142e52cbe69
26 26
27 public Check Check { get; private set; } 27 public Check Check { get; private set; }
28 28
29 public int CheckId { get; private set; } 29 public int CheckId { get; private set; }
30 30
31 public Point HelpLocation { get { return TypeHelpPictureBox.PointToScreen(Point.Empty); } } 31 public Point HelpLocation => TypeHelpPictureBox.PointToScreen(Point.Empty);
32 32
33 public CheckForm(ServerMonitor monitor, Check check) 33 public CheckForm(ServerMonitor monitor, Check check)
34 { 34 {
35 InitializeComponent(); 35 InitializeComponent();
36 36
48 } 48 }
49 49
50 private void CheckForm_Load(object sender, EventArgs e) 50 private void CheckForm_Load(object sender, EventArgs e)
51 { 51 {
52 CheckTypeComboBox.Items.AddRange(Check.CheckTypes); 52 CheckTypeComboBox.Items.AddRange(Check.CheckTypes);
53 SeverityComboBox.Items.AddRange(new object[] { CheckStatus.Error, CheckStatus.Warning, CheckStatus.Information });
54 SeverityComboBox.SelectedIndex = 0;
53 FrequencyUnitsComboBox.DataSource = Enum.GetValues(typeof(FrequencyUnits)); 55 FrequencyUnitsComboBox.DataSource = Enum.GetValues(typeof(FrequencyUnits));
54 Helpers.FormatImageButton(RunButton); 56 Helpers.FormatImageButton(RunButton);
55 Helpers.FormatImageButton(CancelRunButton); 57 Helpers.FormatImageButton(CancelRunButton);
56 58
57 Move += CheckForm_Move; 59 Move += CheckForm_Move;
113 private void LoadCheck(Check check) 115 private void LoadCheck(Check check)
114 { 116 {
115 NameTextBox.Text = Check.Name; 117 NameTextBox.Text = Check.Name;
116 EnabledCheckBox.Checked = check.Enabled; 118 EnabledCheckBox.Checked = check.Enabled;
117 TimeoutInput.Value = check.Timeout; 119 TimeoutInput.Value = check.Timeout;
120 SeverityComboBox.SelectedItem = check.FailStatus;
118 FrequencyUnitsComboBox.SelectedItem = check.Schedule.Units; 121 FrequencyUnitsComboBox.SelectedItem = check.Schedule.Units;
119 FrequencyUpDown.Value = check.Schedule.Frequency; 122 FrequencyUpDown.Value = check.Schedule.Frequency;
120 StartTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.StartTime; 123 StartTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.StartTime;
121 EndTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.EndTime; 124 EndTimePicker.Value = new DateTime(1970, 1, 1) + check.Schedule.EndTime;
122 checkControl?.LoadCheck(check); 125 checkControl?.LoadCheck(check);
134 check.Id = CheckId; 137 check.Id = CheckId;
135 check.Server = server; 138 check.Server = server;
136 check.Name = NameTextBox.Text; 139 check.Name = NameTextBox.Text;
137 check.Enabled = EnabledCheckBox.Checked; 140 check.Enabled = EnabledCheckBox.Checked;
138 check.Timeout = (int)TimeoutInput.Value; 141 check.Timeout = (int)TimeoutInput.Value;
142 check.FailStatus = (CheckStatus)SeverityComboBox.SelectedItem;
139 check.Schedule = new Schedule((FrequencyUnits)FrequencyUnitsComboBox.SelectedItem, (int)FrequencyUpDown.Value, StartTimePicker.Value.TimeOfDay, EndTimePicker.Value.TimeOfDay); 143 check.Schedule = new Schedule((FrequencyUnits)FrequencyUnitsComboBox.SelectedItem, (int)FrequencyUpDown.Value, StartTimePicker.Value.TimeOfDay, EndTimePicker.Value.TimeOfDay);
140 try 144 try
141 { 145 {
142 checkControl?.UpdateCheck(check); 146 checkControl?.UpdateCheck(check);
143 result = check.Validate(saving); 147 result = check.Validate(saving);