comparison ServerMonitor/Controls/HttpCheckControl.cs @ 9:7127d5b5ac75

Code cleanup and comments
author Brad Greco <brad@bgreco.net>
date Mon, 08 Apr 2019 21:29:54 -0400
parents 9e92780ebc0f
children b713b9db4c82
comparison
equal deleted inserted replaced
8:052aa62cb42a 9:7127d5b5ac75
1 using System; 1 namespace ServerMonitorApp
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9
10 namespace ServerMonitorApp
11 { 2 {
3 /// <summary>Control for editing an HTTP check.</summary>
12 [CheckType(typeof(HttpCheck))] 4 [CheckType(typeof(HttpCheck))]
13 public partial class HttpCheckControl : CheckControl 5 public partial class HttpCheckControl : CheckControl
14 { 6 {
15 public HttpCheckControl() 7 public HttpCheckControl()
16 { 8 {
17 InitializeComponent(); 9 InitializeComponent();
18 } 10 }
19 11
12 /// <summary>Sets the values of the controls from a check's properties.</summary>
20 public override void LoadCheck(Check check1) 13 public override void LoadCheck(Check check1)
21 { 14 {
22 HttpCheck check = (HttpCheck)check1; 15 HttpCheck check = (HttpCheck)check1;
23 UrlTextBox.Text = check.Url; 16 UrlTextBox.Text = check.Url;
24 ResponseCodeCheckBox.Checked = check.CheckResponseCode; 17 ResponseCodeCheckBox.Checked = check.CheckResponseCode;
30 ResponseBodyComboBox.SelectedIndex = (int)check.ResponseBodyMatchType; 23 ResponseBodyComboBox.SelectedIndex = (int)check.ResponseBodyMatchType;
31 ResponseBodyTextBox.Text = check.ResponseBodyPattern; 24 ResponseBodyTextBox.Text = check.ResponseBodyPattern;
32 ResponseBodyRegexCheckBox.Checked = check.ResponseBodyUseRegex; 25 ResponseBodyRegexCheckBox.Checked = check.ResponseBodyUseRegex;
33 } 26 }
34 27
28 /// <summary>Updates the properties of a check from user input.</summary>
35 public override void UpdateCheck(Check check1) 29 public override void UpdateCheck(Check check1)
36 { 30 {
37 HttpCheck check = (HttpCheck)check1; 31 HttpCheck check = (HttpCheck)check1;
38 check.Url = UrlTextBox.Text.Trim(); 32 check.Url = UrlTextBox.Text.Trim();
39 check.CheckResponseCode = ResponseCodeCheckBox.Checked; 33 check.CheckResponseCode = ResponseCodeCheckBox.Checked;