-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
506 additions
and
290 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
...dpal/Microsoft.CmdPal.UI/LoadingPage.xaml → ...icrosoft.CmdPal.UI/Pages/LoadingPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/Settings/ExtensionsPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Page | ||
x:Class="Microsoft.CmdPal.UI.Pages.ExtensionsPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:CommunityToolkit.WinUI.Controls" | ||
xmlns:converters="using:CommunityToolkit.WinUI.Converters" | ||
xmlns:cpcontrols="using:Microsoft.CmdPal.UI.Controls" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:helpers="using:Microsoft.CmdPal.UI.Helpers" | ||
xmlns:local="using:Microsoft.CmdPal.UI.Pages" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:ui="using:CommunityToolkit.WinUI" | ||
xmlns:viewmodels="using:Microsoft.CmdPal.UI.ViewModels" | ||
mc:Ignorable="d"> | ||
|
||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<TextBlock | ||
MaxWidth="1000" | ||
Style="{StaticResource TitleTextBlockStyle}" | ||
Text="Extensions" /> | ||
<ScrollViewer Grid.Row="1" Padding="0,0,8,0"> | ||
<Grid Padding="8,16,8,8"> | ||
<StackPanel | ||
MaxWidth="1000" | ||
HorizontalAlignment="Stretch" | ||
Spacing="{StaticResource SettingsCardSpacing}"> | ||
|
||
<ItemsRepeater ItemsSource="{x:Bind ViewModel.CommandProviders, Mode=OneWay}" Layout="{StaticResource VerticalStackLayout}"> | ||
<ItemsRepeater.ItemTemplate> | ||
<DataTemplate x:DataType="viewmodels:ProviderSettingsViewModel"> | ||
<controls:SettingsCard ContentAlignment="Left" IsClickEnabled="True"> | ||
<!-- | ||
What we're doing here is 90% stupid. | ||
The SettingsCard APIs only explicitly allow an | ||
Icon as the content for the HeaderIcon property. | ||
We of course, have to do the goofy async IconBox thing. | ||
To manage this, we have to basically re-create | ||
the layout of the SettingsCard HeaderIcon, | ||
Header & Description, all within the Content. | ||
Most of what follows is lifted directly from | ||
https://github.com/CommunityToolkit/Windows/blob/main/components/SettingsControls/src/SettingsCard/SettingsCard.xaml | ||
--> | ||
<Grid Margin="0,-12,0,0" HorizontalAlignment="Stretch"> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="*" /> | ||
<RowDefinition Height="Auto" /> | ||
</Grid.RowDefinitions> | ||
<Grid.ColumnDefinitions> | ||
<ColumnDefinition Width="Auto" MinWidth="0" /> | ||
<ColumnDefinition Width="*" /> | ||
<ColumnDefinition Width="Auto" /> | ||
<ColumnDefinition Width="Auto" /> | ||
</Grid.ColumnDefinitions> | ||
|
||
<Viewbox | ||
Grid.RowSpan="1" | ||
MaxWidth="20" | ||
MaxHeight="20" | ||
Margin="2,0,20,0"> | ||
<cpcontrols:IconBox | ||
Width="20" | ||
Height="20" | ||
Margin="0,0,0,0" | ||
AutomationProperties.AccessibilityView="Raw" | ||
SourceKey="{x:Bind Icon, Mode=OneWay}" | ||
SourceRequested="{x:Bind helpers:IconCacheProvider.SourceRequested}" /> | ||
</Viewbox> | ||
|
||
<StackPanel | ||
Grid.Column="1" | ||
Margin="0,0,24,0" | ||
VerticalAlignment="Center" | ||
Orientation="Vertical"> | ||
<ContentPresenter | ||
Grid.Column="1" | ||
HorizontalAlignment="Left" | ||
Content="{x:Bind DisplayName, Mode=OneWay}" | ||
HighContrastAdjustment="None" | ||
TextWrapping="Wrap" /> | ||
|
||
<ContentPresenter | ||
Content="{x:Bind ExtensionName, Mode=OneWay}" | ||
FontSize="12" | ||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" | ||
TextWrapping="Wrap" /> | ||
</StackPanel> | ||
|
||
<!-- | ||
Because of this insane XAML thing we're | ||
doing, we can't effectively put content | ||
here on the right. Sad. | ||
--> | ||
|
||
<!--<ContentPresenter | ||
Grid.Column="2" | ||
HorizontalAlignment="Right" | ||
VerticalAlignment="Center" | ||
HorizontalContentAlignment="Right"> | ||
<ToggleSwitch IsOn="{x:Bind IsEnabled, Mode=TwoWay}"/> | ||
</ContentPresenter>--> | ||
</Grid> | ||
</controls:SettingsCard> | ||
</DataTemplate> | ||
</ItemsRepeater.ItemTemplate> | ||
</ItemsRepeater> | ||
</StackPanel> | ||
</Grid> | ||
</ScrollViewer> | ||
</Grid> | ||
</Page> |
45 changes: 45 additions & 0 deletions
45
src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/Settings/ExtensionsPage.xaml.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// 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.CmdPal.UI.ViewModels; | ||
using Microsoft.Extensions.DependencyInjection; | ||
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.Pages; | ||
|
||
public sealed partial class ExtensionsPage : Page | ||
{ | ||
private readonly TaskScheduler _mainTaskScheduler = TaskScheduler.FromCurrentSynchronizationContext(); | ||
|
||
public SettingsViewModel? ViewModel | ||
{ | ||
get => (SettingsViewModel?)GetValue(ViewModelProperty); | ||
set => SetValue(ViewModelProperty, value); | ||
} | ||
|
||
// Using a DependencyProperty as the backing store for ViewModel. This enables animation, styling, binding, etc... | ||
public static readonly DependencyProperty ViewModelProperty = | ||
DependencyProperty.Register(nameof(ViewModel), typeof(SettingsViewModel), typeof(ExtensionsPage), new PropertyMetadata(null, null)); | ||
|
||
public ExtensionsPage() | ||
{ | ||
this.InitializeComponent(); | ||
|
||
var settings = App.Current.Services.GetService<SettingsModel>()!; | ||
ViewModel = new SettingsViewModel(settings, App.Current.Services, _mainTaskScheduler); | ||
} | ||
} |
108 changes: 108 additions & 0 deletions
108
src/modules/cmdpal/Microsoft.CmdPal.UI/Pages/Settings/GeneralPage.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<Page | ||
x:Class="Microsoft.CmdPal.UI.Pages.GeneralPage" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:controls="using:CommunityToolkit.WinUI.Controls" | ||
xmlns:converters="using:CommunityToolkit.WinUI.Converters" | ||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" | ||
xmlns:local="using:Microsoft.CmdPal.UI.Pages" | ||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" | ||
xmlns:ptControls="using:Microsoft.CmdPal.UI.Controls" | ||
xmlns:ui="using:CommunityToolkit.WinUI" | ||
xmlns:viewmodels="using:Microsoft.CmdPal.UI.ViewModels" | ||
mc:Ignorable="d"> | ||
<Grid> | ||
<Grid.RowDefinitions> | ||
<RowDefinition Height="Auto" /> | ||
<RowDefinition Height="*" /> | ||
</Grid.RowDefinitions> | ||
<TextBlock | ||
MaxWidth="1000" | ||
Style="{StaticResource TitleTextBlockStyle}" | ||
Text="General" /> | ||
<ScrollViewer Grid.Row="1" Padding="0,0,8,0"> | ||
<Grid Padding="8,16,8,8"> | ||
<StackPanel | ||
MaxWidth="1000" | ||
HorizontalAlignment="Stretch" | ||
Spacing="{StaticResource SettingsCardSpacing}"> | ||
|
||
<!-- | ||
I got these from the samples, but they break XAML hot-reloading, | ||
so I commented them out. | ||
--> | ||
|
||
<!--<StackPanel.ChildrenTransitions> | ||
<EntranceThemeTransition FromVerticalOffset="50" /> | ||
<RepositionThemeTransition IsStaggeringEnabled="False" /> | ||
</StackPanel.ChildrenTransitions>--> | ||
|
||
<controls:SettingsExpander | ||
Description="This key will open the Command Palette" | ||
Header="Activation key" | ||
HeaderIcon="{ui:FontIcon Glyph=}" | ||
IsExpanded="True"> | ||
<ptControls:ShortcutControl HotkeySettings="{x:Bind ViewModel.Hotkey, Mode=TwoWay}" /> | ||
|
||
<controls:SettingsExpander.Items> | ||
<controls:SettingsCard | ||
Description="If enabled, the Command Palette will return to the home page when activated" | ||
Header="Go home when activated" | ||
HeaderIcon="{ui:FontIcon Glyph=}"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.HotkeyGoesHome, Mode=TwoWay}" /> | ||
</controls:SettingsCard> | ||
<controls:SettingsCard Description="When enabled, the previous search text will be selected when the app is opened" Header="Highlight search on activate"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.HighlightSearchOnActivate, Mode=TwoWay}" /> | ||
</controls:SettingsCard> | ||
</controls:SettingsExpander.Items> | ||
</controls:SettingsExpander> | ||
|
||
<controls:SettingsCard | ||
Description="Controls if app details are automatically expanded or not" | ||
Header="Show app details" | ||
HeaderIcon="{ui:FontIcon Glyph=}"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.ShowAppDetails, Mode=TwoWay}" /> | ||
</controls:SettingsCard> | ||
|
||
<controls:SettingsCard | ||
Description="When enabled, pressing backspace when the search text is empty will take you back" | ||
Header="Backspace goes back" | ||
HeaderIcon="{ui:FontIcon Glyph=}"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.BackspaceGoesBack, Mode=TwoWay}" /> | ||
</controls:SettingsCard> | ||
|
||
<controls:SettingsCard | ||
Description="When enabled, single click activates list items. When disabled, single click selects and double click activates." | ||
Header="Single-click activates" | ||
HeaderIcon="{ui:FontIcon Glyph=}"> | ||
<ToggleSwitch IsOn="{x:Bind ViewModel.SingleClickActivates, Mode=TwoWay}" /> | ||
</controls:SettingsCard> | ||
|
||
<!-- Example 'About' section --> | ||
<TextBlock x:Uid="AboutSettingsHeader" Style="{StaticResource SettingsSectionHeaderTextBlockStyle}" /> | ||
|
||
<controls:SettingsExpander | ||
Description="© 2025. All rights reserved." | ||
Header="Windows Command Palette" | ||
HeaderIcon="{ui:BitmapIcon Source=ms-appx:///Assets/StoreLogo.png}"> | ||
<TextBlock | ||
Foreground="{ThemeResource TextFillColorSecondaryBrush}" | ||
IsTextSelectionEnabled="True" | ||
Text="Version 0.0.1" /> | ||
<controls:SettingsExpander.Items> | ||
<controls:SettingsCard HorizontalContentAlignment="Left" ContentAlignment="Left"> | ||
<StackPanel Margin="-12,0,0,0" Orientation="Vertical"> | ||
<HyperlinkButton Content="Link 1" /> | ||
<HyperlinkButton Content="Link 2" /> | ||
<HyperlinkButton Content="Link 3" /> | ||
</StackPanel> | ||
</controls:SettingsCard> | ||
</controls:SettingsExpander.Items> | ||
</controls:SettingsExpander> | ||
<HyperlinkButton Margin="0,8,0,0" Content="Send feedback" /> | ||
</StackPanel> | ||
</Grid> | ||
</ScrollViewer> | ||
</Grid> | ||
</Page> |
Oops, something went wrong.