diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs index 46463c812c..bbfeba4348 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/Commands/MainListPage.cs @@ -34,7 +34,6 @@ public partial class MainListPage : DynamicListPage, { Name = "Command Palette"; Icon = new(Path.Combine(AppDomain.CurrentDomain.BaseDirectory.ToString(), "Assets\\StoreLogo.scale-200.png")); - ShowDetails = true; _serviceProvider = serviceProvider; var tlcManager = _serviceProvider.GetService()!; @@ -46,6 +45,10 @@ public partial class MainListPage : DynamicListPage, WeakReferenceMessenger.Default.Register(this); + var settings = _serviceProvider.GetService()!; + settings.SettingsChanged += SettingsChangedHandler; + HotReloadSettings(settings); + IsLoading = true; } @@ -180,4 +183,14 @@ public partial class MainListPage : DynamicListPage, { SearchText = string.Empty; } + + private void SettingsChangedHandler(SettingsModel sender, object? args) + { + HotReloadSettings(sender); + } + + private void HotReloadSettings(SettingsModel settings) + { + ShowDetails = settings.ShowAppDetails; + } } diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsModel.cs index f9d1122643..3f6ed42eb5 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsModel.cs @@ -23,6 +23,8 @@ public partial class SettingsModel : ObservableObject // SETTINGS HERE public HotkeySettings? Hotkey { get; set; } = new HotkeySettings(true, true, false, false, 0xBE); + public bool ShowAppDetails { get; set; } + public Dictionary ProviderSettings { get; set; } = []; // END SETTINGS diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs index c73c8c23f7..ea71219744 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI.ViewModels/SettingsViewModel.cs @@ -23,6 +23,16 @@ public partial class SettingsViewModel : PageViewModel } } + public bool ShowAppDetails + { + get => _settings.ShowAppDetails; + set + { + _settings.ShowAppDetails = value; + Save(); + } + } + public ObservableCollection CommandProviders { get; } = []; public SettingsViewModel(SettingsModel settings, IServiceProvider serviceProvider, TaskScheduler scheduler) diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj index 769dcc7c0a..154f1a8d16 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/Microsoft.CmdPal.UI.csproj @@ -16,6 +16,9 @@ false false + + + true diff --git a/src/modules/cmdpal/Microsoft.CmdPal.UI/SettingsPage.xaml b/src/modules/cmdpal/Microsoft.CmdPal.UI/SettingsPage.xaml index b8091afc33..db075424bc 100644 --- a/src/modules/cmdpal/Microsoft.CmdPal.UI/SettingsPage.xaml +++ b/src/modules/cmdpal/Microsoft.CmdPal.UI/SettingsPage.xaml @@ -64,6 +64,13 @@ HeaderIcon="{ui:FontIcon Glyph=}"> + + + +