Skip to content

Commit f2717be

Browse files
authored
Merge pull request #1958 from onesounds/FixSound
Fix the sound issue
2 parents 6869aee + 91f9351 commit f2717be

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
using System.Windows.Data;
2525
using ModernWpf.Controls;
2626
using Key = System.Windows.Input.Key;
27+
using System.Media;
2728

2829
namespace Flow.Launcher
2930
{
@@ -37,8 +38,8 @@ public partial class MainWindow
3738
private NotifyIcon _notifyIcon;
3839
private ContextMenu contextMenu;
3940
private MainViewModel _viewModel;
40-
private readonly MediaPlayer animationSound = new();
4141
private bool _animating;
42+
SoundPlayer animationSound = new SoundPlayer(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav");
4243

4344
#endregion
4445

@@ -49,8 +50,7 @@ public MainWindow(Settings settings, MainViewModel mainVM)
4950
_settings = settings;
5051

5152
InitializeComponent();
52-
InitializePosition();
53-
animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
53+
InitializePosition();
5454
}
5555

5656
public MainWindow()
@@ -114,7 +114,6 @@ private void OnLoaded(object sender, RoutedEventArgs _)
114114
{
115115
if (_settings.UseSound)
116116
{
117-
animationSound.Position = TimeSpan.Zero;
118117
animationSound.Play();
119118
}
120119
UpdatePosition();

0 commit comments

Comments
 (0)