diff --git a/Flow.Launcher/Converters/StringEqualityToVisibilityConverter.cs b/Flow.Launcher/Converters/StringEqualityToVisibilityConverter.cs
deleted file mode 100644
index 4e4453636..000000000
--- a/Flow.Launcher/Converters/StringEqualityToVisibilityConverter.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System;
-using System.Globalization;
-using System.Windows;
-using System.Windows.Data;
-
-namespace Flow.Launcher.Converters
-{
- public class StringEqualityToVisibilityConverter : IValueConverter
- {
- public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
- {
- if (value == null || parameter == null)
- return Visibility.Collapsed;
-
- return value.ToString() == parameter.ToString() ? Visibility.Visible : Visibility.Collapsed;
- }
-
- public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
- {
- throw new NotImplementedException();
- }
- }
-}
diff --git a/Flow.Launcher/Languages/en.xaml b/Flow.Launcher/Languages/en.xaml
index b869a82e1..78486dad4 100644
--- a/Flow.Launcher/Languages/en.xaml
+++ b/Flow.Launcher/Languages/en.xaml
@@ -135,9 +135,9 @@
Plugin seach delay time
Change Plugin Seach Delay Time
Advanced Settings:
- Enabled
- Priority
- Search Delay
+ Enabled
+ Priority
+ Search Delay
Current Priority
New Priority
Priority
diff --git a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml
index 6dffa303e..615904d66 100644
--- a/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml
+++ b/Flow.Launcher/Resources/Controls/InstalledPluginDisplay.xaml
@@ -3,17 +3,17 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
+ xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.modernwpf.com/2019"
xmlns:viewModel="clr-namespace:Flow.Launcher.ViewModel"
- xmlns:converters="clr-namespace:Flow.Launcher.Converters"
d:DataContext="{d:DesignInstance viewModel:PluginViewModel}"
d:DesignHeight="300"
d:DesignWidth="300"
mc:Ignorable="d">
-
+
+
-
-
-
-
-
-
+ Visibility="{Binding DataContext.IsPrioritySelected, RelativeSource={RelativeSource AncestorType=ListBox}, Converter={StaticResource BooleanToVisibilityConverter}}">
+ Margin="0 0 8 0"
+ VerticalAlignment="Center"
+ FontSize="13"
+ Foreground="{DynamicResource Color08B}"
+ Text="{DynamicResource priority}"
+ ToolTip="{DynamicResource priorityToolTip}" />
+ SpinButtonPlacementMode="Inline"
+ ToolTip="{DynamicResource priorityToolTip}" />
+ Orientation="Horizontal"
+ Visibility="{Binding DataContext.IsSearchDelaySelected, RelativeSource={RelativeSource AncestorType=ListBox}, Converter={StaticResource BooleanToVisibilityConverter}}">
-
+ Text="{DynamicResource searchDelay}"
+ ToolTip="{DynamicResource searchDelayToolTip}" />
+
+
-
+ Visibility="{Binding DataContext.IsOnOffSelected, RelativeSource={RelativeSource AncestorType=ListBox}, Converter={StaticResource BooleanToVisibilityConverter}}" />
+
@@ -148,8 +104,6 @@
-
-
-
+
diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs
index 754b15989..af1653c93 100644
--- a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs
+++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginsViewModel.cs
@@ -19,8 +19,13 @@ public partial class SettingsPanePluginsViewModel : BaseModel
{
private readonly Settings _settings;
- private string _selectedDisplayMode = "OnOff";
- public string SelectedDisplayMode
+ public class DisplayModeData : DropdownDataGeneric { }
+
+ public List DisplayModes { get; } =
+ DropdownDataGeneric.GetValues("DisplayMode");
+
+ private DisplayMode _selectedDisplayMode = DisplayMode.OnOff;
+ public DisplayMode SelectedDisplayMode
{
get => _selectedDisplayMode;
set
@@ -28,34 +33,12 @@ public partial class SettingsPanePluginsViewModel : BaseModel
if (_selectedDisplayMode != value)
{
_selectedDisplayMode = value;
- OnPropertyChanged(nameof(SelectedDisplayMode));
+ OnPropertyChanged();
UpdateDisplayModeFromSelection();
}
}
}
- public void UpdateDisplayModeFromSelection()
- {
- switch (SelectedDisplayMode)
- {
- case "OnOff":
- IsOnOffSelected = true;
- IsPrioritySelected = false;
- IsSearchDelaySelected = false;
- break;
- case "Priority":
- IsOnOffSelected = false;
- IsPrioritySelected = true;
- IsSearchDelaySelected = false;
- break;
- case "SearchDelay":
- IsOnOffSelected = false;
- IsPrioritySelected = false;
- IsSearchDelaySelected = true;
- break;
- }
- }
-
private bool _isOnOffSelected = true;
public bool IsOnOffSelected
{
@@ -65,8 +48,7 @@ public partial class SettingsPanePluginsViewModel : BaseModel
if (_isOnOffSelected != value)
{
_isOnOffSelected = value;
- OnPropertyChanged(nameof(IsOnOffSelected));
- UpdateDisplayMode();
+ OnPropertyChanged();
}
}
}
@@ -80,8 +62,7 @@ public partial class SettingsPanePluginsViewModel : BaseModel
if (_isPrioritySelected != value)
{
_isPrioritySelected = value;
- OnPropertyChanged(nameof(IsPrioritySelected));
- UpdateDisplayMode();
+ OnPropertyChanged();
}
}
}
@@ -95,38 +76,15 @@ public partial class SettingsPanePluginsViewModel : BaseModel
if (_isSearchDelaySelected != value)
{
_isSearchDelaySelected = value;
- OnPropertyChanged(nameof(IsSearchDelaySelected));
- UpdateDisplayMode();
+ OnPropertyChanged();
}
}
}
- private string _currentDisplayMode = "OnOff";
- public string CurrentDisplayMode
- {
- get => _currentDisplayMode;
- set
- {
- if (_currentDisplayMode != value)
- {
- _currentDisplayMode = value;
- OnPropertyChanged(nameof(CurrentDisplayMode));
- }
- }
- }
-
- private void UpdateDisplayMode()
- {
- if (IsOnOffSelected)
- CurrentDisplayMode = "OnOff";
- else if (IsPrioritySelected)
- CurrentDisplayMode = "Priority";
- else if (IsSearchDelaySelected)
- CurrentDisplayMode = "SearchDelay";
- }
public SettingsPanePluginsViewModel(Settings settings)
{
_settings = settings;
+ UpdateEnumDropdownLocalizations();
}
public string FilterText { get; set; } = string.Empty;
@@ -196,4 +154,38 @@ public partial class SettingsPanePluginsViewModel : BaseModel
await helpDialog.ShowAsync();
}
+
+ private void UpdateEnumDropdownLocalizations()
+ {
+ DropdownDataGeneric.UpdateLabels(DisplayModes);
+ }
+
+ private void UpdateDisplayModeFromSelection()
+ {
+ switch (SelectedDisplayMode)
+ {
+ case DisplayMode.Priority:
+ IsOnOffSelected = false;
+ IsPrioritySelected = true;
+ IsSearchDelaySelected = false;
+ break;
+ case DisplayMode.SearchDelay:
+ IsOnOffSelected = false;
+ IsPrioritySelected = false;
+ IsSearchDelaySelected = true;
+ break;
+ default:
+ IsOnOffSelected = true;
+ IsPrioritySelected = false;
+ IsSearchDelaySelected = false;
+ break;
+ }
+ }
+}
+
+public enum DisplayMode
+{
+ OnOff,
+ Priority,
+ SearchDelay
}
diff --git a/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml b/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml
index 5498b293c..f9f708314 100644
--- a/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml
+++ b/Flow.Launcher/SettingPages/Views/SettingsPanePlugins.xaml
@@ -3,7 +3,6 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:cc="clr-namespace:Flow.Launcher.Resources.Controls"
- xmlns:converters="clr-namespace:Flow.Launcher.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:sys="clr-namespace:System;assembly=mscorlib"
@@ -16,10 +15,6 @@
FocusManager.FocusedElement="{Binding ElementName=PluginFilterTextbox}"
KeyDown="SettingsPanePlugins_OnKeyDown"
mc:Ignorable="d">
-
-
-
-
@@ -53,19 +48,10 @@
Margin="0 0 4 0"
HorizontalContentAlignment="Left"
Background="{DynamicResource Color00B}"
+ DisplayMemberPath="Display"
+ ItemsSource="{Binding DisplayModes}"
SelectedValue="{Binding SelectedDisplayMode, Mode=TwoWay}"
- SelectedValuePath="Tag"
- SelectionChanged="DisplayModeComboBox_SelectionChanged">
-
-
-
-
-
-
-
-
-
-
+ SelectedValuePath="Value" />