comparison ServerMonitor/Controls/HttpCheckControl.cs @ 0:3e1a2131f897

Initial commit. Ping check, scheduling, UI working. SSH check mostly working.
author Brad Greco <brad@bgreco.net>
date Mon, 31 Dec 2018 18:32:14 -0500
parents
children 9e92780ebc0f
comparison
equal deleted inserted replaced
-1:000000000000 0:3e1a2131f897
1 using System;
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 {
12 [CheckType(typeof(HttpCheck))]
13 public partial class HttpCheckControl : CheckControl
14 {
15 public HttpCheckControl()
16 {
17 InitializeComponent();
18 }
19
20 public override void LoadCheck(Check check1)
21 {
22 HttpCheck check = (HttpCheck)check1;
23 UrlTextBox.Text = check.Url;
24 ResponseCodeCheckBox.Checked = check.CheckResponseCode;
25 ResponseCodeTextBox.Text = check.ResponseCode.ToString();
26 ResponseLengthCheckbox.Checked = check.CheckResponseLength;
27 ResponseLengthMinTextBox.Text = check.ResponseLengthMin;
28 ResponseLengthMaxTextBox.Text = check.ResponseLengthMax;
29 ResponseBodyCheckBox.Checked = check.CheckResponseBody;
30 ResponseBodyComboBox.SelectedIndex = (int)check.ResponseBodyMatchType;
31 ResponseBodyTextBox.Text = check.ResponseBodyPattern;
32 ResponseBodyRegexCheckBox.Checked = check.ResponseBodyUseRegex;
33 }
34
35 public override void UpdateCheck(Check check1)
36 {
37 HttpCheck check = (HttpCheck)check1;
38 check.Url = UrlTextBox.Text.Trim();
39 check.CheckResponseCode = ResponseCodeCheckBox.Checked;
40 check.ResponseCode = int.Parse(ResponseCodeTextBox.Text);
41 check.CheckResponseLength = ResponseLengthCheckbox.Checked;
42 check.ResponseLengthMin = ResponseLengthMinTextBox.Text;
43 check.ResponseLengthMax = ResponseLengthMaxTextBox.Text;
44 check.CheckResponseBody = ResponseBodyCheckBox.Checked;
45 check.ResponseBodyMatchType = (MatchType)ResponseBodyComboBox.SelectedIndex;
46 check.ResponseBodyPattern = ResponseBodyTextBox.Text;
47 check.ResponseBodyUseRegex = ResponseBodyRegexCheckBox.Checked;
48 }
49 }
50 }