/// <summary> /// This callback will be called when there is some error with the audio /// source. It can be used to route exceptions so they don't compromise /// the audio processing pipeline. /// </summary> /// private void source_AudioSourceError(object sender, AudioSourceErrorEventArgs e) { throw new Exception(e.Description); }
// Error handling private void device_AudioSourceError(object sender, AudioSourceErrorEventArgs e) { if (videoPlayer.InvokeRequired) { videoPlayer.BeginInvoke((Action)((() => device_AudioSourceError(sender, e)))); return; } StopRecording(); IAudioSource source = sender as IAudioSource; source.SignalToStop(); string msg = String.Format( // TODO: Move the message box code to the view CultureInfo.CurrentUICulture, Resources.Error_Audio_Source, source.Source); MessageBox.Show(msg, source.Source, MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, videoPlayer.RightToLeft == RightToLeft.Yes ? MessageBoxOptions.RtlReading | MessageBoxOptions.RightAlign : 0); }