Mercurial > servermonitor
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ServerMonitor/Controls/HttpCheckControl.cs Mon Dec 31 18:32:14 2018 -0500 @@ -0,0 +1,50 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Drawing; +using System.Data; +using System.Linq; +using System.Text; +using System.Windows.Forms; + +namespace ServerMonitorApp +{ + [CheckType(typeof(HttpCheck))] + public partial class HttpCheckControl : CheckControl + { + public HttpCheckControl() + { + InitializeComponent(); + } + + public override void LoadCheck(Check check1) + { + HttpCheck check = (HttpCheck)check1; + UrlTextBox.Text = check.Url; + ResponseCodeCheckBox.Checked = check.CheckResponseCode; + ResponseCodeTextBox.Text = check.ResponseCode.ToString(); + ResponseLengthCheckbox.Checked = check.CheckResponseLength; + ResponseLengthMinTextBox.Text = check.ResponseLengthMin; + ResponseLengthMaxTextBox.Text = check.ResponseLengthMax; + ResponseBodyCheckBox.Checked = check.CheckResponseBody; + ResponseBodyComboBox.SelectedIndex = (int)check.ResponseBodyMatchType; + ResponseBodyTextBox.Text = check.ResponseBodyPattern; + ResponseBodyRegexCheckBox.Checked = check.ResponseBodyUseRegex; + } + + public override void UpdateCheck(Check check1) + { + HttpCheck check = (HttpCheck)check1; + check.Url = UrlTextBox.Text.Trim(); + check.CheckResponseCode = ResponseCodeCheckBox.Checked; + check.ResponseCode = int.Parse(ResponseCodeTextBox.Text); + check.CheckResponseLength = ResponseLengthCheckbox.Checked; + check.ResponseLengthMin = ResponseLengthMinTextBox.Text; + check.ResponseLengthMax = ResponseLengthMaxTextBox.Text; + check.CheckResponseBody = ResponseBodyCheckBox.Checked; + check.ResponseBodyMatchType = (MatchType)ResponseBodyComboBox.SelectedIndex; + check.ResponseBodyPattern = ResponseBodyTextBox.Text; + check.ResponseBodyUseRegex = ResponseBodyRegexCheckBox.Checked; + } + } +}