private void ShowConnectionStatsForm() { if (this.connectionStatsForm == null || this.connectionStatsForm.IsDisposed) { // If the form has been closed, or never shown before, we need all new stuff this.connectionStatsForm = new Form { Width = 430, Height = 180, MaximizeBox = false, MinimizeBox = false, FormBorderStyle = FormBorderStyle.FixedDialog, Text = "Link Stats" }; // Change the connection stats control, so that when/if the connection stats form is showing, // there will be something to see this.connectionStatsForm.Controls.Clear(); _connectionStats = new ConnectionStats(comPort); this.connectionStatsForm.Controls.Add(_connectionStats); this.connectionStatsForm.Width = _connectionStats.Width; } this.connectionStatsForm.Show(); ThemeManager.ApplyThemeTo(this.connectionStatsForm); }
private void ResetConnectionStats() { // If the form has been closed, or never shown before, we need do nothing, as // connection stats will be reset when shown if (this.connectionStatsForm != null && connectionStatsForm.Visible) { // else the form is already showing. reset the stats this.connectionStatsForm.Controls.Clear(); _connectionStats = new ConnectionStats(comPort); this.connectionStatsForm.Controls.Add(_connectionStats); ThemeManager.ApplyThemeTo(this.connectionStatsForm); } }