From 4540100fdce5a46dbf872d275f07d87cb376cb4d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 30 Jun 2021 13:26:41 -0700 Subject: [PATCH] Fix a couple oddities in PlayerView --- RedBookPlayer/GUI/PlayerView.xaml.cs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/RedBookPlayer/GUI/PlayerView.xaml.cs b/RedBookPlayer/GUI/PlayerView.xaml.cs index 533e076..105ed38 100644 --- a/RedBookPlayer/GUI/PlayerView.xaml.cs +++ b/RedBookPlayer/GUI/PlayerView.xaml.cs @@ -64,6 +64,9 @@ namespace RedBookPlayer.GUI /// Path to the image to load public async Task LoadImage(string path) { + // If the player is currently running, stop it + if(Player.Playing) Player.Stop(); + bool result = await Task.Run(() => { Player.Init(path, App.Settings.AutoPlay); @@ -202,7 +205,7 @@ namespace RedBookPlayer.GUI if (path == null) return; - LoadImage(path); + await LoadImage(path); } public void PlayButton_Click(object sender, RoutedEventArgs e) => Player.TogglePlayPause(true); @@ -229,6 +232,8 @@ namespace RedBookPlayer.GUI public void DisableDeEmphasisButton_Click(object sender, RoutedEventArgs e) => Player.ToggleDeEmphasis(false); + public void EnableDisableDeEmphasisButton_Click(object sender, RoutedEventArgs e) => Player.ToggleDeEmphasis(!Player.ApplyDeEmphasis); + #endregion } } \ No newline at end of file