mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-04 02:06:36 +02:00
CmdPal: Fix SUI crash ; Allow extensions to be disabled (#38040)
Both `TopLevelCommandItemWrapper` and `TopLevelViewModel` were really the same thing. The latter was from an earlier prototype, and the former is a more correct, safer abstraction. We really should have only ever used the former, but alas, we only used it for the SUI, and it piggy-backed off the latter, and that meant the latter's bugs became the former's. tldr: I made the icon access safe in the SUI. And while I was doing this, because we now have a cleaner VM abstraction here in the host, we can actually cleanly disable extensions, because the `CommandProviderWrapper` knows which `ViewModel`s it made. Closes https://github.com/zadjii-msft/PowerToys/issues/426 Closes https://github.com/zadjii-msft/PowerToys/issues/478 Closes https://github.com/zadjii-msft/PowerToys/issues/577
This commit is contained in:
@@ -24,9 +24,11 @@
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
<ItemGroup>
|
||||
<Content Update="Assets\Run@2x.svg">
|
||||
<None Remove="Assets\Run_V2_2x.svg" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Update="Assets\Run_V2_2x.svg">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
|
||||
@@ -15,7 +15,7 @@ internal sealed partial class ShellListPage : DynamicListPage
|
||||
|
||||
public ShellListPage(SettingsManager settingsManager)
|
||||
{
|
||||
Icon = new IconInfo("\uE756");
|
||||
Icon = Icons.RunV2;
|
||||
Id = "com.microsoft.cmdpal.shell";
|
||||
Name = Resources.cmd_plugin_name;
|
||||
PlaceholderText = Resources.list_placeholder_text;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace Microsoft.CmdPal.Ext.Shell.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Run as administrator (Ctrl+Shift+Enter).
|
||||
/// Looks up a localized string similar to Run as administrator.
|
||||
/// </summary>
|
||||
public static string cmd_run_as_administrator {
|
||||
get {
|
||||
@@ -124,7 +124,7 @@ namespace Microsoft.CmdPal.Ext.Shell.Properties {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Run as different user (Ctrl+Shift+U).
|
||||
/// Looks up a localized string similar to Run as different user.
|
||||
/// </summary>
|
||||
public static string cmd_run_as_user {
|
||||
get {
|
||||
|
||||
@@ -130,7 +130,7 @@
|
||||
<value>execute command through command shell</value>
|
||||
</data>
|
||||
<data name="cmd_run_as_administrator" xml:space="preserve">
|
||||
<value>Run as administrator (Ctrl+Shift+Enter)</value>
|
||||
<value>Run as administrator</value>
|
||||
</data>
|
||||
<data name="cmd_command_failed" xml:space="preserve">
|
||||
<value>Error running the command</value>
|
||||
@@ -139,7 +139,7 @@
|
||||
<value>Command not found</value>
|
||||
</data>
|
||||
<data name="cmd_run_as_user" xml:space="preserve">
|
||||
<value>Run as different user (Ctrl+Shift+U)</value>
|
||||
<value>Run as different user</value>
|
||||
</data>
|
||||
<data name="leave_shell_open" xml:space="preserve">
|
||||
<value>Keep shell open</value>
|
||||
|
||||
@@ -18,6 +18,7 @@ public partial class SystemCommandExtensionProvider : CommandProvider
|
||||
public SystemCommandExtensionProvider()
|
||||
{
|
||||
DisplayName = Resources.Microsoft_plugin_ext_system_page_name;
|
||||
Id = "System";
|
||||
_commands = [
|
||||
new CommandItem(Page)
|
||||
{
|
||||
|
||||
@@ -22,7 +22,7 @@ public partial class TimeDateCommandsProvider : CommandProvider
|
||||
public TimeDateCommandsProvider()
|
||||
{
|
||||
DisplayName = Resources.Microsoft_plugin_timedate_plugin_name;
|
||||
|
||||
Id = "DateTime";
|
||||
_command = new CommandItem(_timeDateExtensionPage)
|
||||
{
|
||||
Icon = _timeDateExtensionPage.Icon,
|
||||
|
||||
Reference in New Issue
Block a user