public void UnLink() { StopStreaming(); if (statisticForm != null) { statisticForm.Stop(); statisticForm.Visible = false; } if (previewForm != null && !previewForm.IsDisposed) { previewForm.Close(); previewForm = null; } //... mainForm = null; }
private void OnStreamStopped() { infoButton.Enabled = true; networkSettingsLayoutPanel.Enabled = true; videoSourceSettingsLayoutPanel.Enabled = true; audioSourceSettingsLayoutPanel.Enabled = true; switchStreamingStateButton.Enabled = true; switchStreamingStateButton.Text = "Start Streaming"; startToolStripMenuItem.Text = "Start"; contextMenu.Enabled = true; captureStatusLabel.Text = "Ready to stream"; captureStatusDescriptionLabel.Text = ""; this.Cursor = Cursors.Default; if (statisticForm != null) { statisticForm.Stop(); statisticForm.Visible = false; } if (debugBorderForm != null) { debugBorderForm.Close(); debugBorderForm = null; } if (selectAreaForm != null) { selectAreaForm.Capturing = false; } var errorMessage = ""; var ex = mediaStreamer.ExceptionObj; if (ex != null) { errorMessage = ex.Message; var iex = ex.InnerException; if (iex != null) { errorMessage = iex.Message; } } if (mediaStreamer != null) { mediaStreamer.Shutdown(); } if (!string.IsNullOrEmpty(errorMessage)) { MessageBox.Show(errorMessage); } }