Add a setting to control if details are shown for apps (#300)

Adds a setting to control if the `Details` pane is shown for apps on the main page or not. I'm defaulting this to off, because that pane doesn't add any value currently.
This commit is contained in:
Mike Griese
2025-01-13 14:48:32 -06:00
committed by GitHub
parent 72f2907485
commit df7878342b
5 changed files with 36 additions and 1 deletions

View File

@@ -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<TopLevelCommandManager>()!;
@@ -46,6 +45,10 @@ public partial class MainListPage : DynamicListPage,
WeakReferenceMessenger.Default.Register<ClearSearchMessage>(this);
var settings = _serviceProvider.GetService<SettingsModel>()!;
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;
}
}

View File

@@ -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<string, ProviderSettings> ProviderSettings { get; set; } = [];
// END SETTINGS

View File

@@ -23,6 +23,16 @@ public partial class SettingsViewModel : PageViewModel
}
}
public bool ShowAppDetails
{
get => _settings.ShowAppDetails;
set
{
_settings.ShowAppDetails = value;
Save();
}
}
public ObservableCollection<ProviderSettingsViewModel> CommandProviders { get; } = [];
public SettingsViewModel(SettingsModel settings, IServiceProvider serviceProvider, TaskScheduler scheduler)

View File

@@ -16,6 +16,9 @@
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<AppendRuntimeIdentifierToOutputPath>false</AppendRuntimeIdentifierToOutputPath>
</PropertyGroup>
<PropertyGroup Condition="'$(CIBuild)'=='true'">
<GenerateAppxPackageOnBuild>true</GenerateAppxPackageOnBuild>
</PropertyGroup>

View File

@@ -64,6 +64,13 @@
HeaderIcon="{ui:FontIcon Glyph=&#xEDA7;}">
<ptControls:ShortcutControl HotkeySettings="{x:Bind ViewModel.Hotkey, Mode=TwoWay}" />
</controls:SettingsCard>
<controls:SettingsCard
Description="Controls if app details are automatically expanded or not"
Header="Show app details"
HeaderIcon="{ui:FontIcon Glyph=&#xE8A0;}">
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowAppDetails, Mode=TwoWay}" />
</controls:SettingsCard>
<TextBlock x:Uid="ExtensionSettingsHeader" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" />