/// <summary> /// When the main form is being closed, we must be sure that any currently /// open tests are terminated properly. So we first stop the test, and then /// we can close safely without losing our log data. /// </summary> /// <param name="sender">The sender of this event.</param> /// <param name="e">The arguments for this event.</param> private void MainForm_Closing(object sender, System.ComponentModel.CancelEventArgs e) { if (_sender != null && _sender.IsConnected) { _sender.Disconnect(); } if (_listener != null && _listener.IsListening) { _listener.Stop(); } if (_sd != null) { mniStopTest_Click(this, EventArgs.Empty); } }