mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
CmdPal: Add to "Manage fallback order" to extensions page menu (#44246)
## Summary of the Pull Request Add "Manage fallback order" menu item to "More options" menu on the extensions list page <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist - [ ] Closes: #xxx <!-- - [ ] Closes: #yyy (add separate lines for additional resolved issues) --> - [ ] **Communication:** I've discussed this with core contributors already. If the work hasn't been agreed, this work might be rejected - [ ] **Tests:** Added/updated and all pass - [ ] **Localization:** All end-user-facing strings can be localized - [ ] **Dev docs:** Added/updated - [ ] **New binaries:** Added on the required places - [ ] [JSON for signing](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ESRPSigning_core.json) for new binaries - [ ] [WXS for installer](https://github.com/microsoft/PowerToys/blob/main/installer/PowerToysSetup/Product.wxs) for new binaries and localization folder - [ ] [YML for CI pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/ci/templates/build-powertoys-steps.yml) for new test projects - [ ] [YML for signed pipeline](https://github.com/microsoft/PowerToys/blob/main/.pipelines/release.yml) - [ ] **Documentation updated:** If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/windows-uwp/tree/docs/hub/powertoys) and link it here: #xxx <!-- Provide a more detailed description of the PR, other things fixed, or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<UserControl
|
||||
x:Class="Microsoft.CmdPal.UI.Controls.FallbackRankerDialog"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:cpcontrols="using:Microsoft.CmdPal.UI.Controls"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
mc:Ignorable="d">
|
||||
<ContentDialog
|
||||
x:Name="FallbackRankerContentDialog"
|
||||
Width="420"
|
||||
MinWidth="420"
|
||||
PrimaryButtonText="OK">
|
||||
<ContentDialog.Title>
|
||||
<TextBlock x:Uid="ManageFallbackRank" />
|
||||
</ContentDialog.Title>
|
||||
<ContentDialog.Resources>
|
||||
<x:Double x:Key="ContentDialogMaxWidth">800</x:Double>
|
||||
</ContentDialog.Resources>
|
||||
<Grid Width="560" MinWidth="420">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
x:Uid="ManageFallbackOrderDialogDescription"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
TextWrapping="Wrap" />
|
||||
<Rectangle
|
||||
Grid.Row="1"
|
||||
Height="1"
|
||||
Margin="0,16,0,16"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{ThemeResource DividerStrokeColorDefaultBrush}" />
|
||||
<cpcontrols:FallbackRanker
|
||||
x:Name="FallbackRanker"
|
||||
Grid.Row="2"
|
||||
Margin="-24,0,-24,0" />
|
||||
</Grid>
|
||||
</ContentDialog>
|
||||
</UserControl>
|
||||
@@ -0,0 +1,33 @@
|
||||
// Copyright (c) Microsoft Corporation
|
||||
// The Microsoft Corporation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices.WindowsRuntime;
|
||||
using Microsoft.UI.Xaml;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Microsoft.UI.Xaml.Controls.Primitives;
|
||||
using Microsoft.UI.Xaml.Data;
|
||||
using Microsoft.UI.Xaml.Input;
|
||||
using Microsoft.UI.Xaml.Media;
|
||||
using Microsoft.UI.Xaml.Navigation;
|
||||
using Windows.Foundation;
|
||||
using Windows.Foundation.Collections;
|
||||
|
||||
namespace Microsoft.CmdPal.UI.Controls;
|
||||
|
||||
public sealed partial class FallbackRankerDialog : UserControl
|
||||
{
|
||||
public FallbackRankerDialog()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
public IAsyncOperation<ContentDialogResult> ShowAsync()
|
||||
{
|
||||
return FallbackRankerContentDialog!.ShowAsync()!;
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,7 @@
|
||||
<None Remove="Controls\ColorPalette.xaml" />
|
||||
<None Remove="Controls\CommandPalettePreview.xaml" />
|
||||
<None Remove="Controls\DevRibbon.xaml" />
|
||||
<None Remove="Controls\FallbackRankerDialog.xaml" />
|
||||
<None Remove="Controls\KeyVisual\KeyCharPresenter.xaml" />
|
||||
<None Remove="Controls\ScreenPreview.xaml" />
|
||||
<None Remove="Controls\SearchBar.xaml" />
|
||||
@@ -231,6 +232,12 @@
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Controls\FallbackRankerDialog.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Page Update="Styles\Theme.Colorful.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
|
||||
@@ -248,38 +248,6 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<ContentDialog
|
||||
x:Name="FallbackRankerDialog"
|
||||
Width="420"
|
||||
MinWidth="420"
|
||||
PrimaryButtonText="OK">
|
||||
<ContentDialog.Title>
|
||||
<TextBlock x:Uid="ManageFallbackRank" />
|
||||
</ContentDialog.Title>
|
||||
<ContentDialog.Resources>
|
||||
<x:Double x:Key="ContentDialogMaxWidth">800</x:Double>
|
||||
</ContentDialog.Resources>
|
||||
<Grid Width="560" MinWidth="420">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="*" />
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock
|
||||
x:Uid="ManageFallbackOrderDialogDescription"
|
||||
Foreground="{ThemeResource TextFillColorSecondaryBrush}"
|
||||
TextWrapping="Wrap" />
|
||||
<Rectangle
|
||||
Grid.Row="1"
|
||||
Height="1"
|
||||
Margin="0,16,0,16"
|
||||
HorizontalAlignment="Stretch"
|
||||
Fill="{ThemeResource DividerStrokeColorDefaultBrush}" />
|
||||
<cpcontrols:FallbackRanker
|
||||
x:Name="FallbackRanker"
|
||||
Grid.Row="2"
|
||||
Margin="-24,0,-24,0" />
|
||||
</Grid>
|
||||
</ContentDialog>
|
||||
<cpcontrols:FallbackRankerDialog x:Name="FallbackRankerDialog" />
|
||||
</Grid>
|
||||
</Page>
|
||||
|
||||
@@ -177,6 +177,12 @@
|
||||
<FontIcon Glyph="" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem x:Uid="Settings_ExtensionsPage_More_ReorderFallbacks_MenuFlyoutItem" Click="MenuFlyoutItem_OnClick">
|
||||
<MenuFlyoutItem.Icon>
|
||||
<FontIcon Glyph="" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
<FontIcon
|
||||
@@ -240,6 +246,7 @@
|
||||
</StackPanel>
|
||||
</Grid>
|
||||
</ScrollViewer>
|
||||
<cpcontrols:FallbackRankerDialog x:Name="FallbackRankerDialog" />
|
||||
<VisualStateManager.VisualStateGroups>
|
||||
<VisualStateGroup x:Name="LayoutVisualStates">
|
||||
<VisualState x:Name="WideLayout">
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
using CommunityToolkit.Mvvm.Messaging;
|
||||
using CommunityToolkit.WinUI.Controls;
|
||||
using ManagedCommon;
|
||||
using Microsoft.CmdPal.UI.ViewModels;
|
||||
using Microsoft.CmdPal.UI.ViewModels.Services;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
@@ -45,4 +46,16 @@ public sealed partial class ExtensionsPage : Page
|
||||
SearchBox?.Focus(FocusState.Keyboard);
|
||||
args.Handled = true;
|
||||
}
|
||||
|
||||
private async void MenuFlyoutItem_OnClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
await FallbackRankerDialog!.ShowAsync();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logger.LogError("Error when showing FallbackRankerDialog", ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -721,4 +721,7 @@ Right-click to remove the key combination, thereby deactivating the shortcut.</v
|
||||
<data name="ManageFallbackOrderDialogDescription.Text" xml:space="preserve">
|
||||
<value>Drag items to set which fallback commands run first; commands at the top take priority.</value>
|
||||
</data>
|
||||
<data name="Settings_ExtensionsPage_More_ReorderFallbacks_MenuFlyoutItem.Text" xml:space="preserve">
|
||||
<value>Manage fallback order</value>
|
||||
</data>
|
||||
</root>
|
||||
Reference in New Issue
Block a user