private void AudioSource_CaptureStopped(object obj) { logger.Debug("AudioSource_CaptureStopped()"); capturing = false; syncContext.Send(_ => { try { if (previewForm != null && !previewForm.IsDisposed) { previewForm.FormClosed -= PreviewForm_FormClosed; previewForm.Close(); previewForm = null; } captureSettingsButton.Enabled = true; } catch (Exception ex) { logger.Error(ex); } finally { this.Cursor = Cursors.Default; this.Enabled = true; } }, null); CloseAudioSource(); }
private void AudioSource_CaptureStarted() { logger.Debug("AudioSource_CaptureStarted()"); capturing = true; syncContext.Send(_ => { try { if (previewForm != null && !previewForm.IsDisposed) { previewForm.FormClosed -= PreviewForm_FormClosed; previewForm.Close(); } previewForm = null; if (previewForm == null) { previewForm = new AudioPreviewForm { Size = new Size(640, 240), StartPosition = FormStartPosition.CenterScreen, Icon = ScreenStreamer.WinForms.App.Properties.Resources.logo, FormBorderStyle = FormBorderStyle.FixedSingle, //ShowIcon = false, }; previewForm.FormClosed += PreviewForm_FormClosed; previewForm.Setup(audioSource.WaveFormat); var device = AudioSettings.CaptureDevice; var text = device.Name + " " + device.Description; previewForm.Text = text; previewForm.Visible = true; } } catch (Exception ex) { logger.Error(ex); } finally { this.Cursor = Cursors.Default; this.Enabled = true; } }, null); }