Sound crash fixed in both INotifier and SoundAnimationView (the preview sound)

This commit is contained in:
Jake Norbut committed 2018-10-26 10:57:34 -05:00
1 parent fdf21c71bb
commit 484c7a98a8
2 files changed
+9 -3

No files matched your search

+3 -1
View File
@@ -102,7 +102,9 @@ namespace mbts.ui {
(_dispatcher = Dispatcher.CurrentDispatcher).UnhandledException += _on_dispatcher_UnhandledException;
Dispatcher.Run();
}
} catch (Exception ex) {
}
catch (NAudio.MmException) { }
catch (Exception ex) {
Log.assert(false, $"Exception in {Thread.CurrentThread.Name} thread: {ex}");
_disposer.Dispose();
}
@@ -28,7 +28,7 @@ namespace mbts.ui.controls {
new AnonymousValueConverter(obj =>
obj is SoundNotification.SystemSound s ?
EnumHelper.get_attribute<SoundNotification.SystemSound, LicenseAttribute>(s)?.link : null);
public static readonly DependencyProperty BusProperty =
WPFHelper.create_dp<IBus, SoundAnimationView>(nameof(Bus));
@@ -38,7 +38,11 @@ namespace mbts.ui.controls {
}
public static ICommand PreviewSoundCommand =>
new DelegateCommand<SoundNotification.SystemSound>(s => NAudioPlayer.create(s).play());
new DelegateCommand<SoundNotification.SystemSound>(s => {
try {
NAudioPlayer.create(s).play();
} catch (NAudio.MmException) { }
});
#region SoundTypes
public static readonly DependencyProperty SoundTypesProperty =