From 4dcb35ee24d2277643d94a91321a20181ae5ae57 Mon Sep 17 00:00:00 2001 From: Yusyuriv Date: Sun, 2 Jun 2024 22:35:58 +0600 Subject: [PATCH] Convert SelectedTheme from string to record --- .../SettingPages/ViewModels/SettingsPaneThemeViewModel.cs | 8 +++++--- Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs index bac29bfcd..64b138a0a 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPaneThemeViewModel.cs @@ -27,12 +27,14 @@ public partial class SettingsPaneThemeViewModel : BaseModel public static string LinkHowToCreateTheme => @"https://flowlauncher.com/docs/#/how-to-create-a-theme"; public static string LinkThemeGallery => "https://github.com/Flow-Launcher/Flow.Launcher/discussions/1438"; - public string SelectedTheme + private Theme.ThemeData _selectedTheme; + public Theme.ThemeData SelectedTheme { - get => Settings.Theme; + get => _selectedTheme ??= Themes.Find(v => v.FileNameWithoutExtension == Settings.Theme); set { - ThemeManager.Instance.ChangeTheme(value); + _selectedTheme = value; + ThemeManager.Instance.ChangeTheme(value.FileNameWithoutExtension); if (ThemeManager.Instance.BlurEnabled && Settings.UseDropShadowEffect) DropShadowEffect = false; diff --git a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml index d7051497b..b5d35606c 100644 --- a/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml +++ b/Flow.Launcher/SettingPages/Views/SettingsPaneTheme.xaml @@ -401,8 +401,7 @@ ItemsSource="{Binding Themes}" ScrollViewer.HorizontalScrollBarVisibility="Disabled" ScrollViewer.VerticalScrollBarVisibility="Auto" - SelectedValue="{Binding SelectedTheme}" - SelectedValuePath="FileNameWithoutExtension"> + SelectedValue="{Binding SelectedTheme}">