Mercurial > servermonitor
diff 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 |
line wrap: on
line diff
--- 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>