From bd867db99aa041b7699e0450287327d0944685f3 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 2 May 2024 07:24:33 +0900 Subject: [PATCH 01/13] Add WMP warning --- Flow.Launcher/Languages/en.xaml | 1 + Flow.Launcher/SettingWindow.xaml | 34 +++++++++++++++++++++++++++++ Flow.Launcher/SettingWindow.xaml.cs | 14 ++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index bda86e481..7aca36e22 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -158,6 +158,7 @@ Play a small sound when the search window opens Sound Effect Volume Adjust the volume of the sound effect + Flow Launcher can't play sound because "Windows Media Player" doesn't exist on your system. If you need sound, install WMP. Animation Use Animation in UI Animation Speed diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 84b91e312..fd999585d 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2561,6 +2561,40 @@ + + + + + + + + + + diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 8144c8ff8..58ffbb149 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -24,6 +24,7 @@ using KeyEventArgs = System.Windows.Input.KeyEventArgs; using MessageBox = System.Windows.MessageBox; using TextBox = System.Windows.Controls.TextBox; using ThemeManager = ModernWpf.ThemeManager; +using System.Diagnostics; namespace Flow.Launcher { @@ -63,9 +64,18 @@ namespace Flow.Launcher viewModel.PropertyChanged += new PropertyChangedEventHandler(SettingsWindowViewModelChanged); + CheckMediaPlayer(); InitializePosition(); } + private void CheckMediaPlayer() + { + + if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer.exe"))) + { + /* Binding WMPWarning visibility */ + } + } private void SettingsWindowViewModelChanged(object sender, PropertyChangedEventArgs e) { if (e.PropertyName == nameof(viewModel.ExternalPlugins)) @@ -294,8 +304,8 @@ namespace Flow.Launcher } private void window_MouseDown(object sender, MouseButtonEventArgs e) /* for close hotkey popup */ - { - if (Keyboard.FocusedElement is not TextBox textBox) + { + if (Keyboard.FocusedElement is not TextBox textBox) { return; } From a4f7a47fbb8dff0cec8a7db8ea5bfcffd991277e Mon Sep 17 00:00:00 2001 From: DB P Date: Fri, 3 May 2024 06:53:14 +0900 Subject: [PATCH 02/13] Update Flow.Launcher/Languages/en.xaml Co-authored-by: VictoriousRaptor <10308169+VictoriousRaptor@users.noreply.github.com> --- Flow.Launcher/Languages/en.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 7aca36e22..9962646c6 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -158,7 +158,7 @@ Play a small sound when the search window opens Sound Effect Volume Adjust the volume of the sound effect - Flow Launcher can't play sound because "Windows Media Player" doesn't exist on your system. If you need sound, install WMP. + Sound effect is unavailable because Windows Media Player is missing. Please install it if you need sound effect. Animation Use Animation in UI Animation Speed From 5670085275c5bb936d6a824f109adb010d330e0d Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 15 May 2024 23:30:27 +0900 Subject: [PATCH 03/13] - add soundplay for no WMP - fix warning visibility --- Flow.Launcher/MainWindow.xaml.cs | 24 +++++++++++++++++++----- Flow.Launcher/SettingWindow.xaml | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 2 +- 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/MainWindow.xaml.cs b/Flow.Launcher/MainWindow.xaml.cs index 76e587cdc..2678d7c27 100644 --- a/Flow.Launcher/MainWindow.xaml.cs +++ b/Flow.Launcher/MainWindow.xaml.cs @@ -29,6 +29,7 @@ using DataObject = System.Windows.DataObject; using System.Windows.Media; using System.Windows.Interop; using System.Runtime.InteropServices; +using System.IO; namespace Flow.Launcher { @@ -46,7 +47,8 @@ namespace Flow.Launcher private ContextMenu contextMenu = new ContextMenu(); private MainViewModel _viewModel; private bool _animating; - MediaPlayer animationSound = new MediaPlayer(); + MediaPlayer animationSoundWMP = new MediaPlayer(); + SoundPlayer animationSoundWPF = new SoundPlayer(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav"); #endregion @@ -59,7 +61,7 @@ namespace Flow.Launcher InitializeComponent(); InitializePosition(); - animationSound.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); + animationSoundWMP.Open(new Uri(AppDomain.CurrentDomain.BaseDirectory + "Resources\\open.wav")); DataObject.AddPastingHandler(QueryTextBox, OnPaste); } @@ -137,9 +139,7 @@ namespace Flow.Launcher { if (_settings.UseSound) { - animationSound.Position = TimeSpan.Zero; - animationSound.Volume = _settings.SoundVolume / 100.0; - animationSound.Play(); + SoundPlay(); } UpdatePosition(); PreviewReset(); @@ -503,6 +503,20 @@ namespace Flow.Launcher windowsb.Begin(FlowMainWindow); } + private void SoundPlay() + { + + if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer.exe"))) + { + animationSoundWPF.Play(); + } + else + { + animationSoundWMP.Position = TimeSpan.Zero; + animationSoundWMP.Volume = _settings.SoundVolume / 100.0; + animationSoundWMP.Play(); + } + } private void OnMouseDown(object sender, MouseButtonEventArgs e) { if (e.ChangedButton == MouseButton.Left) DragMove(); diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index fd999585d..daacd76d5 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2570,7 +2570,7 @@ BorderBrush="{DynamicResource Color03B}" BorderThickness="0,1,0,0" CornerRadius="0 0 5 5" - Visibility="Visible"> + Visibility="Collapsed"> diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 58ffbb149..292559b2f 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -73,7 +73,7 @@ namespace Flow.Launcher if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer.exe"))) { - /* Binding WMPWarning visibility */ + WMPWarning.Visibility = Visibility.Visible; } } private void SettingsWindowViewModelChanged(object sender, PropertyChangedEventArgs e) From a64f10e3123949e71ff27881ec729b62233a3772 Mon Sep 17 00:00:00 2001 From: DB p Date: Wed, 15 May 2024 23:36:33 +0900 Subject: [PATCH 04/13] - Adjust Warning String --- Flow.Launcher/Languages/en.xaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml index 9962646c6..418efe1e2 100644 --- a/Flow.Launcher/Languages/en.xaml +++ b/Flow.Launcher/Languages/en.xaml @@ -158,7 +158,7 @@ Play a small sound when the search window opens Sound Effect Volume Adjust the volume of the sound effect - Sound effect is unavailable because Windows Media Player is missing. Please install it if you need sound effect. + Windows Media Player is unavailable and is required for volume adjust. Please check your WMP installation Animation Use Animation in UI Animation Speed From 2e9d6966dd27f5547d66058a99e8804bb5caca48 Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 16 May 2024 17:48:00 +0900 Subject: [PATCH 05/13] disable volume control --- Flow.Launcher/SettingWindow.xaml.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 292559b2f..35562c018 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -71,9 +71,10 @@ namespace Flow.Launcher private void CheckMediaPlayer() { - if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer.exe"))) + if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer2.exe"))) { WMPWarning.Visibility = Visibility.Visible; + SoundEffectValue.IsEnabled = false; } } private void SettingsWindowViewModelChanged(object sender, PropertyChangedEventArgs e) From 94023cf5cdad7e5ff60b50adc57d0fb1d8a2f3ca Mon Sep 17 00:00:00 2001 From: DB p Date: Thu, 16 May 2024 17:50:24 +0900 Subject: [PATCH 06/13] Fix Testing Code --- Flow.Launcher/SettingWindow.xaml.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Flow.Launcher/SettingWindow.xaml.cs b/Flow.Launcher/SettingWindow.xaml.cs index 35562c018..502094656 100644 --- a/Flow.Launcher/SettingWindow.xaml.cs +++ b/Flow.Launcher/SettingWindow.xaml.cs @@ -71,7 +71,7 @@ namespace Flow.Launcher private void CheckMediaPlayer() { - if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer2.exe"))) + if (!File.Exists(Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), "Windows Media Player", "wmplayer.exe"))) { WMPWarning.Visibility = Visibility.Visible; SoundEffectValue.IsEnabled = false; From 77831df7821d23eb28665449fbfc58134af0d5f2 Mon Sep 17 00:00:00 2001 From: DB p Date: Fri, 17 May 2024 15:29:16 +0900 Subject: [PATCH 07/13] Adjust Control Disabled design. --- Flow.Launcher/SettingWindow.xaml | 2 +- Flow.Launcher/SettingWindow.xaml.cs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Flow.Launcher/SettingWindow.xaml b/Flow.Launcher/SettingWindow.xaml index 263657eb7..bc423bead 100644 --- a/Flow.Launcher/SettingWindow.xaml +++ b/Flow.Launcher/SettingWindow.xaml @@ -2519,7 +2519,7 @@ Width="Auto" BorderThickness="1" Style="{StaticResource SettingSeparatorStyle}" /> - +