Skip to content

Commit 2c3e1bf

Browse files
Move WMP check to app startup
1 parent 490bf59 commit 2c3e1bf

File tree

4 files changed

+7
-6
lines changed

4 files changed

+7
-6
lines changed

Flow.Launcher.Infrastructure/UserSettings/Settings.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,9 @@ public bool HideNotifyIcon
271271
public AnimationSpeeds AnimationSpeed { get; set; } = AnimationSpeeds.Medium;
272272
public int CustomAnimationLength { get; set; } = 360;
273273

274+
[JsonIgnore]
275+
public bool WMPInstalled { get; set; } = true;
276+
274277

275278
// This needs to be loaded last by staying at the bottom
276279
public PluginsSettings PluginSettings { get; set; } = new PluginsSettings();

Flow.Launcher/App.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
6262

6363
_settingsVM = new SettingWindowViewModel(_updater, _portable);
6464
_settings = _settingsVM.Settings;
65+
_settings.WMPInstalled = WindowsMediaPlayerHelper.IsWindowsMediaPlayerInstalled();
6566

6667
AbstractPluginEnvironment.PreStartPluginExecutablePathUpdate(_settings);
6768

Flow.Launcher/MainWindow.xaml.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ public partial class MainWindow
4646
private bool _animating;
4747
private bool isArrowKeyPressed = false;
4848

49-
private bool isWMPInstalled = true;
5049
private MediaPlayer animationSoundWMP;
5150
private SoundPlayer animationSoundWPF;
5251

@@ -509,8 +508,7 @@ public void WindowAnimator()
509508

510509
private void InitSoundEffects()
511510
{
512-
isWMPInstalled = WindowsMediaPlayerHelper.IsWindowsMediaPlayerInstalled();
513-
if (isWMPInstalled)
511+
if (_settings.WMPInstalled)
514512
{
515513
animationSoundWMP = new MediaPlayer();
516514
animationSoundWMP.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"));
@@ -523,8 +521,7 @@ private void InitSoundEffects()
523521

524522
private void SoundPlay()
525523
{
526-
527-
if (isWMPInstalled)
524+
if (_settings.WMPInstalled)
528525
{
529526
animationSoundWMP.Position = TimeSpan.Zero;
530527
animationSoundWMP.Volume = _settings.SoundVolume / 100.0;

Flow.Launcher/SettingWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ private void OnLoaded(object sender, RoutedEventArgs e)
6767

6868
private void CheckMediaPlayer()
6969
{
70-
if (!WindowsMediaPlayerHelper.IsWindowsMediaPlayerInstalled())
70+
if (settings.WMPInstalled)
7171
{
7272
WMPWarning.Visibility = Visibility.Visible;
7373
VolumeAdjustCard.Visibility = Visibility.Collapsed;

0 commit comments

Comments
 (0)