Mercurial > servermonitor
comparison ServerMonitor/Forms/ServerForm.cs @ 39:7645122aa7a9
Get it working under Mono
author | Brad Greco <brad@bgreco.net> |
---|---|
date | Tue, 09 Jun 2020 20:59:00 -0400 |
parents | 2db36ab759de |
children |
comparison
equal
deleted
inserted
replaced
38:8ab98a803d39 | 39:7645122aa7a9 |
---|---|
35 /// <param name="monitor">The global server monitor object.</param> | 35 /// <param name="monitor">The global server monitor object.</param> |
36 /// <param name="server">The server to edit.</param> | 36 /// <param name="server">The server to edit.</param> |
37 /// <param name="isNewServer">Whether an existing server is being edited or a new server is being created.</param> | 37 /// <param name="isNewServer">Whether an existing server is being edited or a new server is being created.</param> |
38 public ServerForm(ServerMonitor monitor, Server server, bool isNewServer = false) | 38 public ServerForm(ServerMonitor monitor, Server server, bool isNewServer = false) |
39 { | 39 { |
40 // Set the Server property before calling InitializeComponent(). | |
41 // Under mono, assigning CheckBindingSource.DataSource = typeof(ServerMonitorApp.Check) | |
42 // in the designer causes incorrect check properties to be displayed in the grid | |
43 // if the first check in the list is of certain types. To fix this, had to hack the | |
44 // designer code and set CheckBindingSource.DataSource directly to the list of | |
45 // checks. Doing it after InitializeComponent() is too late for some reason. | |
46 // Using the designer will probably cause these changes to be lost... | |
47 Server = server; | |
40 InitializeComponent(); | 48 InitializeComponent(); |
41 this.monitor = monitor; | 49 this.monitor = monitor; |
42 this.isNewServer = isNewServer; | 50 this.isNewServer = isNewServer; |
43 Server = server; | |
44 // Associates filter check boxes with their corresponding check statuses. | 51 // Associates filter check boxes with their corresponding check statuses. |
45 filterChecks = new Dictionary<CheckBox, CheckStatus> | 52 filterChecks = new Dictionary<CheckBox, CheckStatus> |
46 { | 53 { |
47 { LogSuccessCheckBox, CheckStatus.Success }, | 54 { LogSuccessCheckBox, CheckStatus.Success }, |
48 { LogInformationCheckBox, CheckStatus.Information }, | 55 { LogInformationCheckBox, CheckStatus.Information }, |
311 foreach (Control control in ServerInfoPanel.Controls.OfType<Control>().Where(c => c is ComboBox)) | 318 foreach (Control control in ServerInfoPanel.Controls.OfType<Control>().Where(c => c is ComboBox)) |
312 control.TextChanged += (sender, e) => UpdateServer(); | 319 control.TextChanged += (sender, e) => UpdateServer(); |
313 // Apply the log filter when the filter checkboxes are changed. | 320 // Apply the log filter when the filter checkboxes are changed. |
314 foreach (CheckBox control in LogTabPage.Controls.OfType<CheckBox>()) | 321 foreach (CheckBox control in LogTabPage.Controls.OfType<CheckBox>()) |
315 control.CheckedChanged += FilterChanged; | 322 control.CheckedChanged += FilterChanged; |
323 // Apply the log filter when the check filter combo box changes. | |
324 // This is done here instead of in the designer so it doesn't fire too early | |
325 // when CheckBindingSource.DataSource is assigned in InitializeComponent(). | |
326 LogCheckComboBox.SelectedIndexChanged += FilterChanged; | |
316 } | 327 } |
317 | 328 |
318 /// <summary>Handles the closing of a check form.</summary> | 329 /// <summary>Handles the closing of a check form.</summary> |
319 private void CheckForm_FormClosing(object sender, FormClosingEventArgs e) | 330 private void CheckForm_FormClosing(object sender, FormClosingEventArgs e) |
320 { | 331 { |