Skip to content

Commit a78a8d7

Browse files
Merge pull request #22356 from unoplatform/dev/mazi/samplesapp-keyboard
2 parents ee126ac + 80d8161 commit a78a8d7

File tree

13 files changed

+506
-31
lines changed

13 files changed

+506
-31
lines changed
Lines changed: 250 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,250 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<Page
3+
x:Class="SamplesApp.Samples.Help.HelpPage"
4+
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
5+
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
6+
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
7+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
8+
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
9+
mc:Ignorable="d">
10+
11+
<ScrollViewer Padding="24">
12+
<StackPanel MaxWidth="600" Spacing="24">
13+
14+
<!-- Header -->
15+
<StackPanel Spacing="8">
16+
<TextBlock
17+
FontSize="28"
18+
FontWeight="SemiBold"
19+
Text="Samples App Help" />
20+
<TextBlock
21+
Foreground="{ThemeResource SystemControlForegroundBaseMediumBrush}"
22+
Text="A guide to using the Uno Platform Samples application"
23+
TextWrapping="Wrap" />
24+
</StackPanel>
25+
26+
<!-- Keyboard Shortcuts -->
27+
<StackPanel Spacing="12">
28+
<TextBlock
29+
FontSize="20"
30+
FontWeight="SemiBold"
31+
Text="Keyboard Shortcuts" />
32+
33+
<Grid
34+
Padding="16"
35+
Background="{ThemeResource CardBackgroundFillColorDefaultBrush}"
36+
CornerRadius="8">
37+
<Grid.ColumnDefinitions>
38+
<ColumnDefinition Width="Auto" />
39+
<ColumnDefinition Width="*" />
40+
</Grid.ColumnDefinitions>
41+
<Grid.RowDefinitions>
42+
<RowDefinition Height="Auto" />
43+
<RowDefinition Height="Auto" />
44+
<RowDefinition Height="Auto" />
45+
<RowDefinition Height="Auto" />
46+
<RowDefinition Height="Auto" />
47+
<RowDefinition Height="Auto" />
48+
<RowDefinition Height="Auto" />
49+
<RowDefinition Height="Auto" />
50+
<RowDefinition Height="Auto" />
51+
</Grid.RowDefinitions>
52+
53+
<TextBlock
54+
Grid.Row="0"
55+
Grid.Column="0"
56+
Margin="0,0,24,8"
57+
FontFamily="Consolas"
58+
FontWeight="SemiBold"
59+
Text="Ctrl+F" />
60+
<TextBlock
61+
Grid.Row="0"
62+
Grid.Column="1"
63+
Margin="0,0,0,8"
64+
Text="Focus the search box" />
65+
66+
<TextBlock
67+
Grid.Row="1"
68+
Grid.Column="0"
69+
Margin="0,0,24,8"
70+
FontFamily="Consolas"
71+
FontWeight="SemiBold"
72+
Text="F5" />
73+
<TextBlock
74+
Grid.Row="1"
75+
Grid.Column="1"
76+
Margin="0,0,0,8"
77+
Text="Reload the current sample" />
78+
79+
<TextBlock
80+
Grid.Row="2"
81+
Grid.Column="0"
82+
Margin="0,0,24,8"
83+
FontFamily="Consolas"
84+
FontWeight="SemiBold"
85+
Text="Alt+Left" />
86+
<TextBlock
87+
Grid.Row="2"
88+
Grid.Column="1"
89+
Margin="0,0,0,8"
90+
Text="Navigate to the previous sample" />
91+
92+
<TextBlock
93+
Grid.Row="3"
94+
Grid.Column="0"
95+
Margin="0,0,24,8"
96+
FontFamily="Consolas"
97+
FontWeight="SemiBold"
98+
Text="Alt+Right" />
99+
<TextBlock
100+
Grid.Row="3"
101+
Grid.Column="1"
102+
Margin="0,0,0,8"
103+
Text="Navigate to the next sample" />
104+
105+
<TextBlock
106+
Grid.Row="4"
107+
Grid.Column="0"
108+
Margin="0,0,24,8"
109+
FontFamily="Consolas"
110+
FontWeight="SemiBold"
111+
Text="Ctrl+Shift+F" />
112+
<TextBlock
113+
Grid.Row="4"
114+
Grid.Column="1"
115+
Margin="0,0,0,8"
116+
Text="Open the Favorites view" />
117+
118+
<TextBlock
119+
Grid.Row="5"
120+
Grid.Column="0"
121+
Margin="0,0,24,8"
122+
FontFamily="Consolas"
123+
FontWeight="SemiBold"
124+
Text="Ctrl+H" />
125+
<TextBlock
126+
Grid.Row="5"
127+
Grid.Column="1"
128+
Margin="0,0,0,8"
129+
Text="Open the History view" />
130+
131+
<TextBlock
132+
Grid.Row="6"
133+
Grid.Column="0"
134+
Margin="0,0,24,8"
135+
FontFamily="Consolas"
136+
FontWeight="SemiBold"
137+
Text="Ctrl+P" />
138+
<TextBlock
139+
Grid.Row="6"
140+
Grid.Column="1"
141+
Margin="0,0,0,8"
142+
Text="Open the Playground" />
143+
144+
<TextBlock
145+
Grid.Row="7"
146+
Grid.Column="0"
147+
Margin="0,0,24,8"
148+
FontFamily="Consolas"
149+
FontWeight="SemiBold"
150+
Text="Ctrl+T" />
151+
<TextBlock
152+
Grid.Row="7"
153+
Grid.Column="1"
154+
Margin="0,0,0,8"
155+
Text="Open the Runtime Tests" />
156+
157+
<TextBlock
158+
Grid.Row="8"
159+
Grid.Column="0"
160+
Margin="0,0,24,0"
161+
FontFamily="Consolas"
162+
FontWeight="SemiBold"
163+
Text="F1" />
164+
<TextBlock
165+
Grid.Row="8"
166+
Grid.Column="1"
167+
Text="Open this Help page" />
168+
</Grid>
169+
</StackPanel>
170+
171+
<!-- Navigation Tips -->
172+
<StackPanel Spacing="12">
173+
<TextBlock
174+
FontSize="20"
175+
FontWeight="SemiBold"
176+
Text="Navigation" />
177+
178+
<StackPanel Spacing="8">
179+
<TextBlock TextWrapping="Wrap">
180+
<Run FontWeight="SemiBold">Library:</Run>
181+
<Run>Browse samples organized by category. Select a category, then select a sample to view it.</Run>
182+
</TextBlock>
183+
<TextBlock TextWrapping="Wrap">
184+
<Run FontWeight="SemiBold">Search:</Run>
185+
<Run>Use the search box to quickly find samples by name. Press Enter to open a single result.</Run>
186+
</TextBlock>
187+
<TextBlock TextWrapping="Wrap">
188+
<Run FontWeight="SemiBold">Favorites:</Run>
189+
<Run>Click the heart icon to add samples to your favorites for quick access.</Run>
190+
</TextBlock>
191+
<TextBlock TextWrapping="Wrap">
192+
<Run FontWeight="SemiBold">History:</Run>
193+
<Run>Recently viewed samples are saved for easy navigation back.</Run>
194+
</TextBlock>
195+
</StackPanel>
196+
</StackPanel>
197+
198+
<!-- Toolbar Options -->
199+
<StackPanel Spacing="12">
200+
<TextBlock
201+
FontSize="20"
202+
FontWeight="SemiBold"
203+
Text="Toolbar Options" />
204+
205+
<StackPanel Spacing="8">
206+
<TextBlock TextWrapping="Wrap">
207+
<Run FontWeight="SemiBold">Theme:</Run>
208+
<Run>Switch between Light, Dark, or System theme.</Run>
209+
</TextBlock>
210+
<TextBlock TextWrapping="Wrap">
211+
<Run FontWeight="SemiBold">Fluent Styles:</Run>
212+
<Run>Toggle WinUI Fluent design styling.</Run>
213+
</TextBlock>
214+
<TextBlock TextWrapping="Wrap">
215+
<Run FontWeight="SemiBold">RTL:</Run>
216+
<Run>Test right-to-left text flow.</Run>
217+
</TextBlock>
218+
<TextBlock TextWrapping="Wrap">
219+
<Run FontWeight="SemiBold">FPS Indicator:</Run>
220+
<Run>Show frame rate counter for performance monitoring.</Run>
221+
</TextBlock>
222+
</StackPanel>
223+
</StackPanel>
224+
225+
<!-- Quick Access -->
226+
<StackPanel Spacing="12">
227+
<TextBlock
228+
FontSize="20"
229+
FontWeight="SemiBold"
230+
Text="Quick Access" />
231+
232+
<StackPanel Spacing="8">
233+
<TextBlock TextWrapping="Wrap">
234+
<Run FontWeight="SemiBold">Runtime Tests:</Run>
235+
<Run>Access the unit test runner from the toolbar button (beaker icon).</Run>
236+
</TextBlock>
237+
<TextBlock TextWrapping="Wrap">
238+
<Run FontWeight="SemiBold">Playground:</Run>
239+
<Run>Open the playground sample for experimentation.</Run>
240+
</TextBlock>
241+
<TextBlock TextWrapping="Wrap">
242+
<Run FontWeight="SemiBold">New Window:</Run>
243+
<Run>Open the samples app in a new window for side-by-side comparison.</Run>
244+
</TextBlock>
245+
</StackPanel>
246+
</StackPanel>
247+
248+
</StackPanel>
249+
</ScrollViewer>
250+
</Page>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
using Microsoft.UI.Xaml.Controls;
2+
using Uno.UI.Samples.Controls;
3+
4+
namespace SamplesApp.Samples.Help
5+
{
6+
[Sample(
7+
"_None",
8+
Name = "Help",
9+
Description = "Help and keyboard shortcuts for the Samples app",
10+
UsesFrame = false,
11+
IgnoreInSnapshotTests = true)]
12+
public sealed partial class HelpPage : Page
13+
{
14+
public HelpPage()
15+
{
16+
this.InitializeComponent();
17+
}
18+
}
19+
}

src/SamplesApp/SamplesApp.Shared/Samples/UnitTests/UnitTestsPage.xaml.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77
namespace SamplesApp.Samples.UnitTests
88
{
99
[Sample(
10-
"Unit Tests",
10+
"_None",
1111
Name = "Unit Tests Runner",
1212
Description = "Test bench to run UI tests that does not require interaction (a.k.a. runtime tests)",
1313
UsesFrame = false,
14-
IgnoreInSnapshotTests = true)]
14+
IgnoreInSnapshotTests = true,
15+
DisableKeyboardShortcuts = true)]
1516
public sealed partial class UnitTestsPage : Page
1617
{
1718
public UnitTestsPage()

src/SamplesApp/SamplesApp.Shared/SamplesApp.Shared.projitems

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
<Compile Include="$(MSBuildThisFileDirectory)Samples\UnitTests\UnitTestsPage.xaml.cs">
3030
<DependentUpon>UnitTestsPage.xaml</DependentUpon>
3131
</Compile>
32+
<Compile Include="$(MSBuildThisFileDirectory)Samples\Help\HelpPage.xaml.cs">
33+
<DependentUpon>HelpPage.xaml</DependentUpon>
34+
</Compile>
3235
<Compile Include="$(MSBuildThisFileDirectory)StringToStyleDictionary.cs" />
3336
</ItemGroup>
3437
<ItemGroup>
@@ -44,6 +47,10 @@
4447
<SubType>Designer</SubType>
4548
<Generator>MSBuild:Compile</Generator>
4649
</Page>
50+
<Page Include="$(MSBuildThisFileDirectory)Samples\Help\HelpPage.xaml">
51+
<SubType>Designer</SubType>
52+
<Generator>MSBuild:Compile</Generator>
53+
</Page>
4754
</ItemGroup>
4855
<ItemGroup>
4956
<Content Include="$(MSBuildThisFileDirectory)Assets\Icons\FluentIcon_Medium.scale-100.png" />

src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Presentation/SampleChooserViewMode.Commands.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ private void InitializeCommands()
5252
OpenRuntimeTestsCommand = new DelegateCommand(() => _ = OpenRuntimeTests(CancellationToken.None));
5353
CreateNewWindowCommand = new DelegateCommand(() => CreateNewWindow());
5454
OpenPlaygroundCommand = new DelegateCommand(() => OpenPlayground());
55+
OpenHelpCommand = new DelegateCommand(() => _ = OpenHelp(CancellationToken.None));
5556
}
5657

5758
public ICommand LogViewDumpCommand { get; private set; }
@@ -65,4 +66,5 @@ private void InitializeCommands()
6566
public ICommand OpenRuntimeTestsCommand { get; private set; }
6667
public ICommand CreateNewWindowCommand { get; private set; }
6768
public ICommand OpenPlaygroundCommand { get; private set; }
69+
public ICommand OpenHelpCommand { get; private set; }
6870
}

src/SamplesApp/SamplesApp.UnitTests.Shared/Controls/UITests/Presentation/SampleChooserViewMode.Properties.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ public bool ManualTestsOnly
144144
{
145145
_manualTestsOnly = value;
146146
RaisePropertyChanged();
147-
RefreshSamples();
147+
UpdateCategoryList();
148148
}
149149
}
150150

@@ -643,5 +643,12 @@ public bool IsRecordAllTests
643643
}
644644
}
645645
}
646+
647+
/// <summary>
648+
/// Returns true if global keyboard shortcuts should be enabled.
649+
/// Shortcuts are disabled when the current sample has DisableKeyboardShortcuts set to true.
650+
/// </summary>
651+
public bool KeyboardShortcutsEnabled =>
652+
CurrentSelectedSample is null || !CurrentSelectedSample.DisableKeyboardShortcuts;
646653
}
647654
}

0 commit comments

Comments
 (0)