comparison ServerMonitor/Controls/SshCheckControl.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(SshCheck))]
13 public partial class SshCheckControl : CheckControl
14 {
15 public SshCheckControl()
16 {
17 InitializeComponent();
18 }
19
20 public override void LoadCheck(Check check1)
21 {
22 SshCheck check = (SshCheck)check1;
23 CommandTextBox.Text = check.Command;
24 ExitCodeCheckBox.Checked = check.CheckExitCode;
25 ExitCodeTextBox.Text = check.ExitCode.ToString();
26 CommandOutputCheckBox.Checked = check.CheckCommandOutput;
27 CommandOutputComboBox.SelectedIndex = (int)check.CommandOutputMatchType;
28 CommandOutputTextBox.Text = check.CommandOutputPattern;
29 CommandOutputRegexCheckBox.Checked = check.CommandOutputUseRegex;
30 }
31
32 public override void UpdateCheck(Check check1)
33 {
34 SshCheck check = (SshCheck)check1;
35 check.Command = CommandTextBox.Text.Trim();
36 check.CheckExitCode = ExitCodeCheckBox.Checked;
37 check.ExitCode = int.Parse(ExitCodeTextBox.Text);
38 check.CheckCommandOutput = CommandOutputCheckBox.Checked;
39 check.CommandOutputMatchType = (MatchType)CommandOutputComboBox.SelectedIndex;
40 check.CommandOutputPattern = CommandOutputTextBox.Text;
41 check.CommandOutputUseRegex = CommandOutputRegexCheckBox.Checked;
42 }
43 }
44 }