Mercurial > servermonitor
changeset 39:7645122aa7a9
Get it working under Mono
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Tue, 09 Jun 2020 20:59:00 -0400 |
parents | 8ab98a803d39 |
children | c4fc74593a78 |
files | ServerMonitor/Forms/ServerForm.Designer.cs ServerMonitor/Forms/ServerForm.cs ServerMonitor/Forms/SettingsForm.cs ServerMonitor/Helpers.cs ServerMonitor/Objects/Checks/Check.cs ServerMonitor/Objects/Checks/HttpCheck.cs ServerMonitor/Objects/Checks/SshCheck.cs ServerMonitor/Objects/Schedule.cs ServerMonitor/Objects/Server.cs ServerMonitor/Program.cs ServerMonitor/Win32Helpers.cs |
diffstat | 11 files changed, 166 insertions(+), 132 deletions(-) [+] |
line wrap: on
line diff
--- a/ServerMonitor/Forms/ServerForm.Designer.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Forms/ServerForm.Designer.cs Tue Jun 09 20:59:00 2020 -0400 @@ -92,9 +92,9 @@ ((System.ComponentModel.ISupportInitialize)(this.CheckBindingSource)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.CheckResultBindingSource)).BeginInit(); this.SuspendLayout(); - // + // // TitleLabel - // + // this.TitleLabel.Dock = System.Windows.Forms.DockStyle.Top; this.TitleLabel.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.TitleLabel.Location = new System.Drawing.Point(0, 0); @@ -104,17 +104,17 @@ this.TitleLabel.TabIndex = 0; this.TitleLabel.Text = "New Server"; this.TitleLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter; - // + // // NameTextBox - // + // this.NameTextBox.Location = new System.Drawing.Point(61, 4); this.NameTextBox.Name = "NameTextBox"; this.NameTextBox.Size = new System.Drawing.Size(271, 20); this.NameTextBox.TabIndex = 3; this.NameTextBox.TextChanged += new System.EventHandler(this.NameTextBox_TextChanged); - // + // // NameLabel - // + // this.NameLabel.AutoSize = true; this.NameLabel.Location = new System.Drawing.Point(6, 7); this.NameLabel.Name = "NameLabel"; @@ -122,23 +122,23 @@ this.NameLabel.TabIndex = 2; this.NameLabel.Text = "Na&me"; this.NameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // HostTextBox - // + // this.HostTextBox.Location = new System.Drawing.Point(61, 30); this.HostTextBox.Name = "HostTextBox"; this.HostTextBox.Size = new System.Drawing.Size(354, 20); this.HostTextBox.TabIndex = 6; - // + // // PortTextBox - // + // this.PortTextBox.Location = new System.Drawing.Point(61, 56); this.PortTextBox.Name = "PortTextBox"; this.PortTextBox.Size = new System.Drawing.Size(57, 20); this.PortTextBox.TabIndex = 8; - // + // // HostLabel - // + // this.HostLabel.AutoSize = true; this.HostLabel.Location = new System.Drawing.Point(6, 33); this.HostLabel.Name = "HostLabel"; @@ -146,9 +146,9 @@ this.HostLabel.TabIndex = 5; this.HostLabel.Text = "&Host"; this.HostLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // PortLabel - // + // this.PortLabel.AutoSize = true; this.PortLabel.Location = new System.Drawing.Point(6, 59); this.PortLabel.Name = "PortLabel"; @@ -156,9 +156,9 @@ this.PortLabel.TabIndex = 7; this.PortLabel.Text = "SSH &port"; this.PortLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // LoginComboBox - // + // this.LoginComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.LoginComboBox.FormattingEnabled = true; this.LoginComboBox.Items.AddRange(new object[] { @@ -169,9 +169,9 @@ this.LoginComboBox.Size = new System.Drawing.Size(80, 21); this.LoginComboBox.TabIndex = 12; this.LoginComboBox.SelectedIndexChanged += new System.EventHandler(this.LoginComboBox_SelectedIndexChanged); - // + // // UsernameLabel - // + // this.UsernameLabel.AutoSize = true; this.UsernameLabel.Location = new System.Drawing.Point(144, 59); this.UsernameLabel.Name = "UsernameLabel"; @@ -179,24 +179,24 @@ this.UsernameLabel.TabIndex = 9; this.UsernameLabel.Text = "SSH &username"; this.UsernameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // UsernameTextBox - // + // this.UsernameTextBox.Location = new System.Drawing.Point(228, 56); this.UsernameTextBox.Name = "UsernameTextBox"; this.UsernameTextBox.Size = new System.Drawing.Size(187, 20); this.UsernameTextBox.TabIndex = 10; - // + // // KeyTextBox - // + // this.KeyTextBox.Location = new System.Drawing.Point(147, 82); this.KeyTextBox.Name = "KeyTextBox"; this.KeyTextBox.Size = new System.Drawing.Size(202, 20); this.KeyTextBox.TabIndex = 13; this.KeyTextBox.Leave += new System.EventHandler(this.KeyTextBox_Leave); - // + // // LoginLabel - // + // this.LoginLabel.AutoSize = true; this.LoginLabel.Location = new System.Drawing.Point(6, 85); this.LoginLabel.Name = "LoginLabel"; @@ -204,9 +204,9 @@ this.LoginLabel.TabIndex = 11; this.LoginLabel.Text = "SSH &login"; this.LoginLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // + // // KeyBrowseButton - // + // this.KeyBrowseButton.Location = new System.Drawing.Point(355, 80); this.KeyBrowseButton.Name = "KeyBrowseButton"; this.KeyBrowseButton.Size = new System.Drawing.Size(60, 23); @@ -214,9 +214,9 @@ this.KeyBrowseButton.Text = "Br&owse..."; this.KeyBrowseButton.UseVisualStyleBackColor = true; this.KeyBrowseButton.Click += new System.EventHandler(this.KeyBrowseButton_Click); - // + // // PasswordTextBox - // + // this.PasswordTextBox.Location = new System.Drawing.Point(147, 82); this.PasswordTextBox.Name = "PasswordTextBox"; this.PasswordTextBox.Size = new System.Drawing.Size(268, 20); @@ -224,15 +224,15 @@ this.PasswordTextBox.UseSystemPasswordChar = true; this.PasswordTextBox.Visible = false; this.PasswordTextBox.TextChanged += new System.EventHandler(this.PasswordTextBox_TextChanged); - // + // // CheckGrid - // + // this.CheckGrid.AllowUserToAddRows = false; this.CheckGrid.AllowUserToDeleteRows = false; this.CheckGrid.AllowUserToOrderColumns = true; this.CheckGrid.AllowUserToResizeRows = false; - this.CheckGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.CheckGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.CheckGrid.AutoGenerateColumns = false; this.CheckGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; @@ -259,35 +259,35 @@ this.CheckGrid.CellMouseLeave += new System.Windows.Forms.DataGridViewCellEventHandler(this.CheckGrid_CellMouseLeave); this.CheckGrid.SelectionChanged += new System.EventHandler(this.CheckGrid_SelectionChanged); this.CheckGrid.KeyDown += new System.Windows.Forms.KeyEventHandler(this.CheckGrid_KeyDown); - // + // // LastRunTimeColumn - // + // this.LastRunTimeColumn.DataPropertyName = "LastRunTime"; this.LastRunTimeColumn.HeaderText = "LastRunTime"; this.LastRunTimeColumn.Name = "LastRunTimeColumn"; this.LastRunTimeColumn.ReadOnly = true; this.LastRunTimeColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - // + // // EnabledColumn - // + // this.EnabledColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.EnabledColumn.DataPropertyName = "Enabled"; this.EnabledColumn.HeaderText = "Enabled"; this.EnabledColumn.Name = "EnabledColumn"; this.EnabledColumn.ReadOnly = true; this.EnabledColumn.Width = 50; - // + // // CheckActionsDividerLabel - // + // this.CheckActionsDividerLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.CheckActionsDividerLabel.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.CheckActionsDividerLabel.Location = new System.Drawing.Point(617, 79); this.CheckActionsDividerLabel.Name = "CheckActionsDividerLabel"; this.CheckActionsDividerLabel.Size = new System.Drawing.Size(75, 2); this.CheckActionsDividerLabel.TabIndex = 26; - // + // // RunAllButton - // + // this.RunAllButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.RunAllButton.Image = ((System.Drawing.Image)(resources.GetObject("RunAllButton.Image"))); this.RunAllButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -301,9 +301,9 @@ this.RunAllButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.RunAllButton.UseVisualStyleBackColor = true; this.RunAllButton.Click += new System.EventHandler(this.RunAllButton_Click); - // + // // RunButton - // + // this.RunButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.RunButton.Image = global::ServerMonitorApp.Properties.Resources.run; this.RunButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -317,9 +317,9 @@ this.RunButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.RunButton.UseVisualStyleBackColor = true; this.RunButton.Click += new System.EventHandler(this.RunButton_Click); - // + // // EditCheckButton - // + // this.EditCheckButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.EditCheckButton.Enabled = false; this.EditCheckButton.Image = global::ServerMonitorApp.Properties.Resources.edit; @@ -334,9 +334,9 @@ this.EditCheckButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.EditCheckButton.UseVisualStyleBackColor = true; this.EditCheckButton.Click += new System.EventHandler(this.EditCheckButton_Click); - // + // // DeleteCheckButton - // + // this.DeleteCheckButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.DeleteCheckButton.Enabled = false; this.DeleteCheckButton.Image = global::ServerMonitorApp.Properties.Resources.delete; @@ -351,9 +351,9 @@ this.DeleteCheckButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.DeleteCheckButton.UseVisualStyleBackColor = true; this.DeleteCheckButton.Click += new System.EventHandler(this.DeleteCheckButton_Click); - // + // // NewCheckButton - // + // this.NewCheckButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.NewCheckButton.Image = ((System.Drawing.Image)(resources.GetObject("NewCheckButton.Image"))); this.NewCheckButton.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; @@ -367,11 +367,11 @@ this.NewCheckButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; this.NewCheckButton.UseVisualStyleBackColor = true; this.NewCheckButton.Click += new System.EventHandler(this.NewCheckButton_Click); - // + // // CheckTabControl - // - this.CheckTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + // + this.CheckTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.CheckTabControl.Controls.Add(this.CheckTabPage); this.CheckTabControl.Controls.Add(this.LogTabPage); @@ -381,9 +381,9 @@ this.CheckTabControl.Size = new System.Drawing.Size(701, 282); this.CheckTabControl.TabIndex = 21; this.CheckTabControl.SelectedIndexChanged += new System.EventHandler(this.CheckTabControl_SelectedIndexChanged); - // + // // CheckTabPage - // + // this.CheckTabPage.BackColor = System.Drawing.SystemColors.Control; this.CheckTabPage.Controls.Add(this.CheckActionsDividerLabel); this.CheckTabPage.Controls.Add(this.CheckGrid); @@ -398,9 +398,9 @@ this.CheckTabPage.Size = new System.Drawing.Size(693, 256); this.CheckTabPage.TabIndex = 0; this.CheckTabPage.Text = "Checks"; - // + // // LogTabPage - // + // this.LogTabPage.BackColor = System.Drawing.SystemColors.Control; this.LogTabPage.Controls.Add(this.LogWarningCheckBox); this.LogTabPage.Controls.Add(this.LogErrorCheckBox); @@ -415,9 +415,9 @@ this.LogTabPage.Size = new System.Drawing.Size(693, 256); this.LogTabPage.TabIndex = 1; this.LogTabPage.Text = "Log"; - // + // // LogWarningCheckBox - // + // this.LogWarningCheckBox.AutoSize = true; this.LogWarningCheckBox.Checked = true; this.LogWarningCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -427,9 +427,9 @@ this.LogWarningCheckBox.TabIndex = 34; this.LogWarningCheckBox.Text = "Warning"; this.LogWarningCheckBox.UseVisualStyleBackColor = true; - // + // // LogErrorCheckBox - // + // this.LogErrorCheckBox.AutoSize = true; this.LogErrorCheckBox.Checked = true; this.LogErrorCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -439,9 +439,9 @@ this.LogErrorCheckBox.TabIndex = 35; this.LogErrorCheckBox.Text = "Error"; this.LogErrorCheckBox.UseVisualStyleBackColor = true; - // + // // LogInformationCheckBox - // + // this.LogInformationCheckBox.AutoSize = true; this.LogInformationCheckBox.Checked = true; this.LogInformationCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -451,9 +451,9 @@ this.LogInformationCheckBox.TabIndex = 32; this.LogInformationCheckBox.Text = "Information"; this.LogInformationCheckBox.UseVisualStyleBackColor = true; - // + // // LogSuccessCheckBox - // + // this.LogSuccessCheckBox.AutoSize = true; this.LogSuccessCheckBox.Checked = true; this.LogSuccessCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -463,34 +463,33 @@ this.LogSuccessCheckBox.TabIndex = 31; this.LogSuccessCheckBox.Text = "Success"; this.LogSuccessCheckBox.UseVisualStyleBackColor = true; - // + // // LogCheckLabel - // + // this.LogCheckLabel.AutoSize = true; this.LogCheckLabel.Location = new System.Drawing.Point(6, 9); this.LogCheckLabel.Name = "LogCheckLabel"; this.LogCheckLabel.Size = new System.Drawing.Size(38, 13); this.LogCheckLabel.TabIndex = 30; this.LogCheckLabel.Text = "Check"; - // + // // LogCheckComboBox - // + // this.LogCheckComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.LogCheckComboBox.FormattingEnabled = true; this.LogCheckComboBox.Location = new System.Drawing.Point(50, 6); this.LogCheckComboBox.Name = "LogCheckComboBox"; this.LogCheckComboBox.Size = new System.Drawing.Size(121, 21); this.LogCheckComboBox.TabIndex = 29; - this.LogCheckComboBox.SelectedIndexChanged += new System.EventHandler(this.FilterChanged); - // + // // LogGrid - // + // this.LogGrid.AllowUserToAddRows = false; this.LogGrid.AllowUserToDeleteRows = false; this.LogGrid.AllowUserToOrderColumns = true; this.LogGrid.AllowUserToResizeRows = false; - this.LogGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) + this.LogGrid.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.LogGrid.AutoGenerateColumns = false; this.LogGrid.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill; @@ -509,9 +508,9 @@ this.LogGrid.Size = new System.Drawing.Size(693, 223); this.LogGrid.TabIndex = 40; this.LogGrid.CellFormatting += new System.Windows.Forms.DataGridViewCellFormattingEventHandler(this.LogGrid_CellFormatting); - // + // // dataGridViewImageColumn1 - // + // this.dataGridViewImageColumn1.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.dataGridViewImageColumn1.DataPropertyName = "Status"; this.dataGridViewImageColumn1.HeaderText = ""; @@ -519,18 +518,18 @@ this.dataGridViewImageColumn1.ReadOnly = true; this.dataGridViewImageColumn1.ToolTipText = "Last Run Status"; this.dataGridViewImageColumn1.Width = 25; - // + // // dataGridViewTextBoxColumn1 - // + // this.dataGridViewTextBoxColumn1.DataPropertyName = "Schedule"; this.dataGridViewTextBoxColumn1.HeaderText = "Schedule"; this.dataGridViewTextBoxColumn1.Name = "dataGridViewTextBoxColumn1"; this.dataGridViewTextBoxColumn1.ReadOnly = true; this.dataGridViewTextBoxColumn1.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.dataGridViewTextBoxColumn1.Width = 192; - // + // // ServerInfoPanel - // + // this.ServerInfoPanel.Anchor = System.Windows.Forms.AnchorStyles.Top; this.ServerInfoPanel.Controls.Add(this.EnabledCheckBox); this.ServerInfoPanel.Controls.Add(this.NameLabel); @@ -550,9 +549,9 @@ this.ServerInfoPanel.Name = "ServerInfoPanel"; this.ServerInfoPanel.Size = new System.Drawing.Size(428, 113); this.ServerInfoPanel.TabIndex = 27; - // + // // EnabledCheckBox - // + // this.EnabledCheckBox.AutoSize = true; this.EnabledCheckBox.Checked = true; this.EnabledCheckBox.CheckState = System.Windows.Forms.CheckState.Checked; @@ -563,9 +562,9 @@ this.EnabledCheckBox.Text = "Ena&bled"; this.EnabledCheckBox.UseVisualStyleBackColor = true; this.EnabledCheckBox.Click += new System.EventHandler(this.EnabledCheckBox_Click); - // + // // dataGridViewImageColumn2 - // + // this.dataGridViewImageColumn2.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.dataGridViewImageColumn2.DataPropertyName = "Status"; this.dataGridViewImageColumn2.HeaderText = ""; @@ -574,18 +573,18 @@ this.dataGridViewImageColumn2.ReadOnly = true; this.dataGridViewImageColumn2.ToolTipText = "Last Run Status"; this.dataGridViewImageColumn2.Width = 25; - // + // // dataGridViewTextBoxColumn2 - // + // this.dataGridViewTextBoxColumn2.DataPropertyName = "Schedule"; this.dataGridViewTextBoxColumn2.HeaderText = "Schedule"; this.dataGridViewTextBoxColumn2.Name = "dataGridViewTextBoxColumn2"; this.dataGridViewTextBoxColumn2.ReadOnly = true; this.dataGridViewTextBoxColumn2.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.dataGridViewTextBoxColumn2.Width = 267; - // + // // dataGridViewImageColumn3 - // + // this.dataGridViewImageColumn3.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.dataGridViewImageColumn3.DataPropertyName = "Status"; this.dataGridViewImageColumn3.HeaderText = ""; @@ -594,18 +593,18 @@ this.dataGridViewImageColumn3.ReadOnly = true; this.dataGridViewImageColumn3.ToolTipText = "Last Run Status"; this.dataGridViewImageColumn3.Width = 25; - // + // // dataGridViewTextBoxColumn3 - // + // this.dataGridViewTextBoxColumn3.DataPropertyName = "Schedule"; this.dataGridViewTextBoxColumn3.HeaderText = "Schedule"; this.dataGridViewTextBoxColumn3.Name = "dataGridViewTextBoxColumn3"; this.dataGridViewTextBoxColumn3.ReadOnly = true; this.dataGridViewTextBoxColumn3.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.dataGridViewTextBoxColumn3.Width = 267; - // + // // StatusColumn - // + // this.StatusColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.StatusColumn.DataPropertyName = "Status"; this.StatusColumn.HeaderText = ""; @@ -614,9 +613,9 @@ this.StatusColumn.ReadOnly = true; this.StatusColumn.ToolTipText = "Last Run Status"; this.StatusColumn.Width = 25; - // + // // NameColumn - // + // this.NameColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.AllCells; this.NameColumn.DataPropertyName = "Name"; this.NameColumn.HeaderText = "Name"; @@ -624,22 +623,24 @@ this.NameColumn.ReadOnly = true; this.NameColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; this.NameColumn.Width = 41; - // + // // ScheduleColumn - // + // this.ScheduleColumn.DataPropertyName = "Schedule"; this.ScheduleColumn.HeaderText = "Schedule"; this.ScheduleColumn.Name = "ScheduleColumn"; this.ScheduleColumn.ReadOnly = true; this.ScheduleColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.NotSortable; - // + // // CheckBindingSource - // - this.CheckBindingSource.DataSource = typeof(ServerMonitorApp.Check); + // + // MANUAL HACK, MAKE SURE THIS STAYS HERE! + // See constructor for more comments. + this.CheckBindingSource.DataSource = Server.Checks; this.CheckBindingSource.ListChanged += new System.ComponentModel.ListChangedEventHandler(this.CheckBindingSource_ListChanged); - // + // // LogStatusColumn - // + // this.LogStatusColumn.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.None; this.LogStatusColumn.DataPropertyName = "CheckStatus"; this.LogStatusColumn.HeaderText = ""; @@ -650,23 +651,23 @@ this.LogStatusColumn.SortMode = System.Windows.Forms.DataGridViewColumnSortMode.Automatic; this.LogStatusColumn.ToolTipText = "Status"; this.LogStatusColumn.Width = 25; - // + // // LogNameColumn - // + // this.LogNameColumn.DataPropertyName = "Check"; this.LogNameColumn.HeaderText = "Check"; this.LogNameColumn.Name = "LogNameColumn"; this.LogNameColumn.ReadOnly = true; - // + // // LogMessageColumn - // + // this.LogMessageColumn.DataPropertyName = "Message"; this.LogMessageColumn.HeaderText = "Message"; this.LogMessageColumn.Name = "LogMessageColumn"; this.LogMessageColumn.ReadOnly = true; - // + // // LogStartTimeColumn - // + // this.LogStartTimeColumn.DataPropertyName = "StartTime"; dataGridViewCellStyle1.Format = "G"; dataGridViewCellStyle1.NullValue = null; @@ -674,9 +675,9 @@ this.LogStartTimeColumn.HeaderText = "StartTime"; this.LogStartTimeColumn.Name = "LogStartTimeColumn"; this.LogStartTimeColumn.ReadOnly = true; - // + // // LogEndTimeColumn - // + // this.LogEndTimeColumn.DataPropertyName = "EndTime"; dataGridViewCellStyle2.Format = "G"; dataGridViewCellStyle2.NullValue = null; @@ -684,13 +685,13 @@ this.LogEndTimeColumn.HeaderText = "EndTime"; this.LogEndTimeColumn.Name = "LogEndTimeColumn"; this.LogEndTimeColumn.ReadOnly = true; - // + // // CheckResultBindingSource - // + // this.CheckResultBindingSource.DataSource = typeof(ServerMonitorApp.CheckResult); - // + // // ServerForm - // + // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(728, 467);
--- a/ServerMonitor/Forms/ServerForm.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Forms/ServerForm.cs Tue Jun 09 20:59:00 2020 -0400 @@ -37,10 +37,17 @@ /// <param name="isNewServer">Whether an existing server is being edited or a new server is being created.</param> public ServerForm(ServerMonitor monitor, Server server, bool isNewServer = false) { + // Set the Server property before calling InitializeComponent(). + // Under mono, assigning CheckBindingSource.DataSource = typeof(ServerMonitorApp.Check) + // in the designer causes incorrect check properties to be displayed in the grid + // if the first check in the list is of certain types. To fix this, had to hack the + // designer code and set CheckBindingSource.DataSource directly to the list of + // checks. Doing it after InitializeComponent() is too late for some reason. + // Using the designer will probably cause these changes to be lost... + Server = server; InitializeComponent(); this.monitor = monitor; this.isNewServer = isNewServer; - Server = server; // Associates filter check boxes with their corresponding check statuses. filterChecks = new Dictionary<CheckBox, CheckStatus> { @@ -313,6 +320,10 @@ // Apply the log filter when the filter checkboxes are changed. foreach (CheckBox control in LogTabPage.Controls.OfType<CheckBox>()) control.CheckedChanged += FilterChanged; + // Apply the log filter when the check filter combo box changes. + // This is done here instead of in the designer so it doesn't fire too early + // when CheckBindingSource.DataSource is assigned in InitializeComponent(). + LogCheckComboBox.SelectedIndexChanged += FilterChanged; } /// <summary>Handles the closing of a check form.</summary>
--- a/ServerMonitor/Forms/SettingsForm.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Forms/SettingsForm.cs Tue Jun 09 20:59:00 2020 -0400 @@ -132,7 +132,6 @@ /// <summary>Shows only the filename of the custom sound.</summary> private void SoundComboBox_Format(object sender, ListControlConvertEventArgs e) { - ComboBox comboBox = (ComboBox)sender; if (!soundOptions.Contains(e.Value)) e.Value = Path.GetFileName(e.Value.ToString()); }
--- a/ServerMonitor/Helpers.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Helpers.cs Tue Jun 09 20:59:00 2020 -0400 @@ -131,5 +131,12 @@ } return false; } + + /// <summary>Returns whether the program is running on Mono.</summary> + /// <returns>True if the program is running on Mono.</returns> + public static bool IsMono() + { + return Type.GetType("Mono.Runtime") != null; + } } }
--- a/ServerMonitor/Objects/Checks/Check.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Objects/Checks/Check.cs Tue Jun 09 20:59:00 2020 -0400 @@ -15,12 +15,12 @@ /// </remarks> public enum CheckStatus { - Success, - Information, - Warning, - Error, - Running, - Disabled, + Success = 0, + Information = 1, + Warning = 2, + Error = 3, + Running = 4, + Disabled = 5, } /// <summary>Base class for checks that run against a server and return a result status.</summary>
--- a/ServerMonitor/Objects/Checks/HttpCheck.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Objects/Checks/HttpCheck.cs Tue Jun 09 20:59:00 2020 -0400 @@ -133,7 +133,7 @@ { try { - Regex re = new Regex(ResponseBodyPattern); + new Regex(ResponseBodyPattern); } catch (ArgumentException) {
--- a/ServerMonitor/Objects/Checks/SshCheck.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Objects/Checks/SshCheck.cs Tue Jun 09 20:59:00 2020 -0400 @@ -117,7 +117,7 @@ { try { - Regex re = new Regex(CommandOutputPattern); + new Regex(CommandOutputPattern); } catch (ArgumentException) {
--- a/ServerMonitor/Objects/Schedule.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Objects/Schedule.cs Tue Jun 09 20:59:00 2020 -0400 @@ -73,7 +73,7 @@ /// last execution time and adding the configured number of time units. The computer might /// have been asleep or the program might have not been running, so the next date might /// be in the past. - /// + /// /// To best follow the schedule, we take the last execution time and fast-forward time /// by adding the configured time interval until we get a resulting time that is in the future. /// For example, suppose a check is scheduled to run every 5 minutes starting at 7:00. @@ -139,5 +139,5 @@ } /// <summary>Units of time that a check can be scheduled to run in intervals of.</summary> - public enum FrequencyUnits { Second, Minute, Hour, Day } + public enum FrequencyUnits { Second = 0, Minute = 1, Hour = 2, Day = 3 } } \ No newline at end of file
--- a/ServerMonitor/Objects/Server.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Objects/Server.cs Tue Jun 09 20:59:00 2020 -0400 @@ -252,13 +252,13 @@ public enum KeyStatus { /// <summary>The private key file is closed for an unspecified reason.</summary> - Closed, + Closed = 0, /// <summary>The private key file is accessible and open.</summary> - Open, + Open = 1, /// <summary>The private key file is not accessible (missing, access denied, etc).</summary> - NotAccessible, + NotAccessible = 2, /// <summary>The private key file is encrypted and the user has not entered the password yet.</summary> - NeedPassword, + NeedPassword = 3, } }
--- a/ServerMonitor/Program.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Program.cs Tue Jun 09 20:59:00 2020 -0400 @@ -57,8 +57,10 @@ /// <param name="e">The exception to show.</param> static void ShowError(Exception e) { - string simpleStackTrace = string.Join(Environment.NewLine, new System.Diagnostics.StackTrace(e).GetFrames() - .Select(f => f.GetMethod().DeclaringType.Name + "." + f.GetMethod().Name).ToArray()); + string simpleStackTrace = Helpers.IsMono() + ? e.ToString() + : string.Join(Environment.NewLine, new System.Diagnostics.StackTrace(e).GetFrames() + .Select(f => f.GetMethod().DeclaringType.Name + "." + f.GetMethod().Name).ToArray()); MessageBox.Show(e.Message + Environment.NewLine + Environment.NewLine + simpleStackTrace, "Server Monitor Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
--- a/ServerMonitor/Win32Helpers.cs Sun Sep 15 21:01:14 2019 -0400 +++ b/ServerMonitor/Win32Helpers.cs Tue Jun 09 20:59:00 2020 -0400 @@ -22,7 +22,13 @@ } public const int HWND_BROADCAST = 0xffff; - public static readonly int WM_SHOWMONITOR = RegisterWindowMessage("WM_SHOWMONITOR"); + + #if __MonoCS__ + public static readonly int WM_SHOWMONITOR = -12345; + #else + public static readonly int WM_SHOWMONITOR = RegisterWindowMessage("WM_SHOWMONITOR"); + #endif + [DllImport("user32")] public static extern bool PostMessage(IntPtr hwnd, int msg, IntPtr wparam, IntPtr lparam); [DllImport("user32")] @@ -32,7 +38,7 @@ { /// <summary> /// Stop flashing. The system restores the window to its original state. - /// </summary> + /// </summary> FLASHW_STOP = 0, /// <summary> @@ -66,6 +72,10 @@ /// <param name="form">The form to flash.</param> public static bool FlashWindowEx(Form form) { + if (Helpers.IsMono()) { + return false; + } + IntPtr hWnd = form.Handle; FLASHWINFO fInfo = new FLASHWINFO(); @@ -82,6 +92,10 @@ /// <param name="form">The form to stop flashing.</param> public static bool StopFlashWindowEx(Form form) { + if (Helpers.IsMono()) { + return false; + } + IntPtr hWnd = form.Handle; FLASHWINFO fInfo = new FLASHWINFO();