Add WMP warning

This commit is contained in:
DB p 2024-05-02 07:24:33 +09:00
parent 1596c59638
commit bd867db99a
3 changed files with 47 additions and 2 deletions

View file

@ -158,6 +158,7 @@
<system:String x:Key="SoundEffectTip">Play a small sound when the search window opens</system:String>
<system:String x:Key="SoundEffectVolume">Sound Effect Volume</system:String>
<system:String x:Key="SoundEffectVolumeTip">Adjust the volume of the sound effect</system:String>
<system:String x:Key="SoundEffectWarning">Flow Launcher can't play sound because "Windows Media Player" doesn't exist on your system. If you need sound, install WMP.</system:String>
<system:String x:Key="Animation">Animation</system:String>
<system:String x:Key="AnimationTip">Use Animation in UI</system:String>
<system:String x:Key="AnimationSpeed">Animation Speed</system:String>

View file

@ -2561,6 +2561,40 @@
</TextBlock>
</ItemsControl>
</Border>
<Border
Name="WMPWarning"
Padding="0,10"
HorizontalAlignment="Stretch"
VerticalAlignment="Center"
Background="{DynamicResource InfoBarWarningBG}"
BorderBrush="{DynamicResource Color03B}"
BorderThickness="0,1,0,0"
CornerRadius="0 0 5 5"
Visibility="Visible">
<Grid VerticalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="58" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<ui:FontIcon
Grid.Column="0"
Margin="20,0,14,0"
VerticalAlignment="Center"
FontSize="15"
Foreground="{DynamicResource InfoBarWarningIcon}"
Glyph="&#xf167;" />
<TextBlock
Grid.Column="1"
Margin="0,0,0,2"
Padding="0,0,8,0"
HorizontalAlignment="Left"
FontSize="13"
FontWeight="SemiBold"
Foreground="{DynamicResource Color05B}"
Text="{DynamicResource SoundEffectWarning}"
TextWrapping="Wrap" />
</Grid>
</Border>
</StackPanel>
</Border>

View file

@ -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;
}