Skip to content

Commit 74efb00

Browse files
committed
Merge branch 'dev/migrie/f/run-page-2-with-history' into dev/migrie/f/bookmark-exes
2 parents 9a3667c + bf83bbd commit 74efb00

File tree

102 files changed

+473
-377
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

102 files changed

+473
-377
lines changed

.pipelines/v2/templates/job-test-project.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ jobs:
160160
vsTestVersion: 'toolsInstaller'
161161
uiTests: true
162162
rerunFailedTests: true
163+
testRunTitle: 'UITests_${{ parameters.platform }}_${{ parameters.installMode }}'
163164
# Since UITests-FancyZonesEditor.dll is generated in both UITests-FancyZonesEditor and UITests-FancyZones, removed one to avoid duplicate test runs
164165
testAssemblyVer2: |
165166
**\*UITest*.dll
@@ -182,6 +183,7 @@ jobs:
182183
vsTestVersion: 'toolsInstaller'
183184
uiTests: true
184185
rerunFailedTests: true
186+
testRunTitle: 'UITests_${{ parameters.platform }}_${{ parameters.installMode }}'
185187
testAssemblyVer2: |
186188
**\*${{ module }}*.dll
187189
!**\obj\**

src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/CommandBarViewModel.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ private ContextKeybindingResult PerformCommand(CommandItemViewModel? command)
149149

150150
if (command.HasMoreCommands)
151151
{
152+
WeakReferenceMessenger.Default.Send<PerformCommandMessage>(new(command.Command.Model, command.Model));
152153
return ContextKeybindingResult.KeepOpen;
153154
}
154155
else

src/modules/cmdpal/Microsoft.CmdPal.Core.ViewModels/ContextMenuViewModel.cs

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,8 @@ public ICommandBarContext? SelectedItem
2222
get => field;
2323
set
2424
{
25-
if (field != null)
26-
{
27-
field.PropertyChanged -= SelectedItemPropertyChanged;
28-
}
29-
3025
field = value;
31-
SetSelectedItem(value);
32-
33-
OnPropertyChanged(nameof(SelectedItem));
26+
UpdateContextItems();
3427
}
3528
}
3629

@@ -68,33 +61,6 @@ public void Receive(OpenContextMenuMessage message)
6861
OnPropertyChanged(nameof(FilterOnTop));
6962
}
7063

71-
private void SetSelectedItem(ICommandBarContext? value)
72-
{
73-
if (value != null)
74-
{
75-
value.PropertyChanged += SelectedItemPropertyChanged;
76-
}
77-
else
78-
{
79-
if (SelectedItem != null)
80-
{
81-
SelectedItem.PropertyChanged -= SelectedItemPropertyChanged;
82-
}
83-
}
84-
85-
UpdateContextItems();
86-
}
87-
88-
private void SelectedItemPropertyChanged(object? sender, System.ComponentModel.PropertyChangedEventArgs e)
89-
{
90-
switch (e.PropertyName)
91-
{
92-
case nameof(SelectedItem.HasMoreCommands):
93-
UpdateContextItems();
94-
break;
95-
}
96-
}
97-
9864
public void UpdateContextItems()
9965
{
10066
if (SelectedItem != null)

src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/CommandBar.xaml.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,11 @@
66
using Microsoft.CmdPal.Core.ViewModels;
77
using Microsoft.CmdPal.Core.ViewModels.Messages;
88
using Microsoft.CmdPal.UI.Views;
9-
using Microsoft.UI.Input;
109
using Microsoft.UI.Xaml;
1110
using Microsoft.UI.Xaml.Controls;
1211
using Microsoft.UI.Xaml.Controls.Primitives;
1312
using Microsoft.UI.Xaml.Input;
1413
using Windows.System;
15-
using Windows.UI.Core;
1614

1715
namespace Microsoft.CmdPal.UI.Controls;
1816

src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
<UserControl.Resources>
2121
<ResourceDictionary>
2222
<cmdpalUI:KeyChordToStringConverter x:Key="KeyChordToStringConverter" />
23+
<converters:BoolToVisibilityConverter x:Key="BoolToVisibilityConverter" />
2324

2425
<cmdpalUI:ContextItemTemplateSelector
2526
x:Key="ContextItemTemplateSelector"
@@ -43,9 +44,18 @@
4344
SourceKey="{x:Bind Icon}"
4445
SourceRequested="{x:Bind help:IconCacheProvider.SourceRequested}" />
4546
<TextBlock
47+
x:Name="TitleTextBlock"
4648
Grid.Column="1"
49+
MaxWidth="200"
50+
HorizontalAlignment="Left"
4751
VerticalAlignment="Center"
48-
Text="{x:Bind Title}" />
52+
Text="{x:Bind Title}"
53+
TextTrimming="WordEllipsis"
54+
TextWrapping="NoWrap">
55+
<ToolTipService.ToolTip>
56+
<ToolTip Content="{x:Bind Title}" Visibility="{Binding IsTextTrimmed, ElementName=TitleTextBlock, Converter={StaticResource BoolToVisibilityConverter}}" />
57+
</ToolTipService.ToolTip>
58+
</TextBlock>
4959
<TextBlock
5060
Grid.Column="2"
5161
Margin="16,0,0,0"
@@ -74,10 +84,19 @@
7484
SourceKey="{x:Bind Icon}"
7585
SourceRequested="{x:Bind help:IconCacheProvider.SourceRequested}" />
7686
<TextBlock
87+
x:Name="TitleTextBlock"
7788
Grid.Column="1"
89+
MaxWidth="200"
90+
HorizontalAlignment="Left"
7891
VerticalAlignment="Center"
7992
Style="{StaticResource ContextItemTitleTextBlockCriticalStyle}"
80-
Text="{x:Bind Title}" />
93+
Text="{x:Bind Title}"
94+
TextTrimming="WordEllipsis"
95+
TextWrapping="NoWrap">
96+
<ToolTipService.ToolTip>
97+
<ToolTip Content="{x:Bind Title}" Visibility="{Binding IsTextTrimmed, ElementName=TitleTextBlock, Converter={StaticResource BoolToVisibilityConverter}}" />
98+
</ToolTipService.ToolTip>
99+
</TextBlock>
81100
<TextBlock
82101
Grid.Column="2"
83102
Margin="16,0,0,0"
@@ -129,6 +148,7 @@
129148
x:Name="ContextFilterBox"
130149
x:Uid="ContextFilterBox"
131150
Margin="4"
151+
IsTextScaleFactorEnabled="True"
132152
KeyDown="ContextFilterBox_KeyDown"
133153
PreviewKeyDown="ContextFilterBox_PreviewKeyDown"
134154
TextChanged="ContextFilterBox_TextChanged" />

src/modules/cmdpal/Microsoft.CmdPal.UI/Controls/ContextMenu.xaml.cs

Lines changed: 77 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -178,32 +178,95 @@ private void ContextFilterBox_PreviewKeyDown(object sender, KeyRoutedEventArgs e
178178
{
179179
if (e.Key == VirtualKey.Up)
180180
{
181-
// navigate previous
182-
if (CommandsDropdown.SelectedIndex > 0)
181+
NavigateUp();
182+
183+
e.Handled = true;
184+
}
185+
else if (e.Key == VirtualKey.Down)
186+
{
187+
NavigateDown();
188+
189+
e.Handled = true;
190+
}
191+
}
192+
193+
private void NavigateUp()
194+
{
195+
var newIndex = CommandsDropdown.SelectedIndex;
196+
197+
if (CommandsDropdown.SelectedIndex > 0)
198+
{
199+
newIndex--;
200+
201+
while (
202+
newIndex >= 0 &&
203+
IsSeparator(CommandsDropdown.Items[newIndex]) &&
204+
newIndex != CommandsDropdown.SelectedIndex)
183205
{
184-
CommandsDropdown.SelectedIndex--;
206+
newIndex--;
185207
}
186-
else
208+
209+
if (newIndex < 0)
187210
{
188-
CommandsDropdown.SelectedIndex = CommandsDropdown.Items.Count - 1;
211+
newIndex = CommandsDropdown.Items.Count - 1;
212+
213+
while (
214+
newIndex >= 0 &&
215+
IsSeparator(CommandsDropdown.Items[newIndex]) &&
216+
newIndex != CommandsDropdown.SelectedIndex)
217+
{
218+
newIndex--;
219+
}
189220
}
221+
}
222+
else
223+
{
224+
newIndex = CommandsDropdown.Items.Count - 1;
225+
}
190226

191-
e.Handled = true;
227+
CommandsDropdown.SelectedIndex = newIndex;
228+
}
229+
230+
private void NavigateDown()
231+
{
232+
var newIndex = CommandsDropdown.SelectedIndex;
233+
234+
if (CommandsDropdown.SelectedIndex == CommandsDropdown.Items.Count - 1)
235+
{
236+
newIndex = 0;
192237
}
193-
else if (e.Key == VirtualKey.Down)
238+
else
194239
{
195-
// navigate next
196-
if (CommandsDropdown.SelectedIndex < CommandsDropdown.Items.Count - 1)
240+
newIndex++;
241+
242+
while (
243+
newIndex < CommandsDropdown.Items.Count &&
244+
IsSeparator(CommandsDropdown.Items[newIndex]) &&
245+
newIndex != CommandsDropdown.SelectedIndex)
197246
{
198-
CommandsDropdown.SelectedIndex++;
247+
newIndex++;
199248
}
200-
else
249+
250+
if (newIndex >= CommandsDropdown.Items.Count)
201251
{
202-
CommandsDropdown.SelectedIndex = 0;
203-
}
252+
newIndex = 0;
204253

205-
e.Handled = true;
254+
while (
255+
newIndex < CommandsDropdown.Items.Count &&
256+
IsSeparator(CommandsDropdown.Items[newIndex]) &&
257+
newIndex != CommandsDropdown.SelectedIndex)
258+
{
259+
newIndex++;
260+
}
261+
}
206262
}
263+
264+
CommandsDropdown.SelectedIndex = newIndex;
265+
}
266+
267+
private bool IsSeparator(object item)
268+
{
269+
return item is SeparatorContextItemViewModel;
207270
}
208271

209272
private void UpdateUiForStackChange()

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsCommandProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public AllAppsCommandProvider()
2525
{
2626
Id = WellKnownId;
2727
DisplayName = Resources.installed_apps;
28-
Icon = IconHelpers.FromRelativePath("Assets\\AllApps.svg");
28+
Icon = Icons.AllAppsIcon;
2929
Settings = AllAppsSettings.Instance.Settings;
3030

3131
_listItem = new(Page)

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/AllAppsPage.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
using System.Threading.Tasks;
1313
using ManagedCommon;
1414
using Microsoft.CmdPal.Ext.Apps.Commands;
15-
using Microsoft.CmdPal.Ext.Apps.Helpers;
1615
using Microsoft.CmdPal.Ext.Apps.Programs;
1716
using Microsoft.CmdPal.Ext.Apps.Properties;
1817
using Microsoft.CmdPal.Ext.Apps.State;

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/CopyPathCommand.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Globalization;
77
using System.Text;
88
using ManagedCommon;
9-
using Microsoft.CmdPal.Ext.Apps.Helpers;
109
using Microsoft.CmdPal.Ext.Apps.Properties;
1110
using Microsoft.CommandPalette.Extensions.Toolkit;
1211

src/modules/cmdpal/ext/Microsoft.CmdPal.Ext.Apps/Commands/OpenInConsoleCommand.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using System.Diagnostics;
77
using System.Threading.Tasks;
88
using ManagedCommon;
9-
using Microsoft.CmdPal.Ext.Apps.Helpers;
109
using Microsoft.CmdPal.Ext.Apps.Properties;
1110
using Microsoft.CommandPalette.Extensions.Toolkit;
1211

@@ -19,7 +18,7 @@ internal sealed partial class OpenInConsoleCommand : InvokableCommand
1918
public OpenInConsoleCommand(string target)
2019
{
2120
Name = Resources.open_path_in_console;
22-
Icon = Icons.OpenConsoleIcon;
21+
Icon = Icons.OpenPathIcon;
2322

2423
_target = target;
2524
}

0 commit comments

Comments
 (0)