Skip to content

Commit

Permalink
No longer crashing! a win!
Browse files Browse the repository at this point in the history
  • Loading branch information
crutkas committed Oct 23, 2024
1 parent 017f0ee commit 576ba90
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 117 deletions.
268 changes: 156 additions & 112 deletions src/settings-ui/Settings.UI/SettingsXAML/Views/ShellPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -106,123 +106,167 @@
<NavigationViewItemSeparator />

<!-- System Tools -->
<NavigationViewItem
x:Uid="Shell_AdvancedPaste"
helpers:NavHelper.NavigateTo="views:AdvancedPastePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AdvancedPaste.png}" />
<NavigationViewItem
x:Uid="Shell_Awake"
helpers:NavHelper.NavigateTo="views:AwakePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Awake.png}" />
<NavigationViewItem
x:Uid="Shell_ColorPicker"
helpers:NavHelper.NavigateTo="views:ColorPickerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ColorPicker.png}" />
<NavigationViewItem
x:Uid="Shell_PowerLauncher"
helpers:NavHelper.NavigateTo="views:PowerLauncherPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerToysRun.png}" />
<NavigationViewItem
x:Uid="Shell_MeasureTool"
helpers:NavHelper.NavigateTo="views:MeasureToolPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ScreenRuler.png}" />
<NavigationViewItem
x:Uid="Shell_ShortcutGuide"
helpers:NavHelper.NavigateTo="views:ShortcutGuidePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ShortcutGuide.png}" />
<NavigationViewItem
x:Uid="Shell_TextExtractor"
helpers:NavHelper.NavigateTo="views:PowerOcrPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/TextExtractor.png}" />
<NavigationViewItem
x:Uid="Shell_SystemToolTopLevel"
Content="System Tools"
ToolTipService.ToolTip="System Tools"
Icon="Page2"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_AdvancedPaste"
helpers:NavHelper.NavigateTo="views:AdvancedPastePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AdvancedPaste.png}" />
<NavigationViewItem
x:Uid="Shell_Awake"
helpers:NavHelper.NavigateTo="views:AwakePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Awake.png}" />
<NavigationViewItem
x:Uid="Shell_ColorPicker"
helpers:NavHelper.NavigateTo="views:ColorPickerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ColorPicker.png}" />
<NavigationViewItem
x:Uid="Shell_PowerLauncher"
helpers:NavHelper.NavigateTo="views:PowerLauncherPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerToysRun.png}" />
<NavigationViewItem
x:Uid="Shell_MeasureTool"
helpers:NavHelper.NavigateTo="views:MeasureToolPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ScreenRuler.png}" />
<NavigationViewItem
x:Uid="Shell_ShortcutGuide"
helpers:NavHelper.NavigateTo="views:ShortcutGuidePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ShortcutGuide.png}" />
<NavigationViewItem
x:Uid="Shell_TextExtractor"
helpers:NavHelper.NavigateTo="views:PowerOcrPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/TextExtractor.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>

<!-- Windowing & Layouts -->
<NavigationViewItem
x:Uid="Shell_AlwaysOnTop"
helpers:NavHelper.NavigateTo="views:AlwaysOnTopPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AlwaysOnTop.png}" />
<NavigationViewItem
x:Uid="Shell_CropAndLock"
helpers:NavHelper.NavigateTo="views:CropAndLockPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CropAndLock.png}" />
<NavigationViewItem
x:Uid="Shell_FancyZones"
helpers:NavHelper.NavigateTo="views:FancyZonesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FancyZones.png}" />
<NavigationViewItem
x:Uid="Shell_Workspaces"
helpers:NavHelper.NavigateTo="views:WorkspacesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Workspaces.png}" />

<NavigationViewItem
x:Uid="Shell_WindowsAndLayoutsTopLevel"
Content="Windowing &amp; Layouts"
ToolTipService.ToolTip="Windowing &amp; Layouts"
Icon="Page2"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_AlwaysOnTop"
helpers:NavHelper.NavigateTo="views:AlwaysOnTopPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/AlwaysOnTop.png}" />
<NavigationViewItem
x:Uid="Shell_CropAndLock"
helpers:NavHelper.NavigateTo="views:CropAndLockPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CropAndLock.png}" />
<NavigationViewItem
x:Uid="Shell_FancyZones"
helpers:NavHelper.NavigateTo="views:FancyZonesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FancyZones.png}" />
<NavigationViewItem
x:Uid="Shell_Workspaces"
helpers:NavHelper.NavigateTo="views:WorkspacesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Workspaces.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>

<!-- Input / Output -->
<NavigationViewItem
x:Uid="Shell_KeyboardManager"
helpers:NavHelper.NavigateTo="views:KeyboardManagerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/KeyboardManager.png}" />
<!-- Find my mouse -->
<!-- Mouse Hightlighter -->
<NavigationViewItem
x:Uid="Shell_MouseUtilities"
helpers:NavHelper.NavigateTo="views:MouseUtilsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseUtils.png}" />
<NavigationViewItem
x:Uid="Shell_MouseWithoutBorders"
helpers:NavHelper.NavigateTo="views:MouseWithoutBordersPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseWithoutBorders.png}" />
<NavigationViewItem
x:Uid="Shell_QuickAccent"
helpers:NavHelper.NavigateTo="views:PowerAccentPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/QuickAccent.png}" />
<!-- Mouse pointer cross hair -->
<NavigationViewItem
x:Uid="Shell_VideoConference"
helpers:NavHelper.NavigateTo="views:VideoConferencePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
IsEnabled="{x:Bind ViewModel.IsVideoConferenceBuild, Mode=OneWay}" />

<!-- File Management -->
<NavigationViewItem
x:Uid="Shell_PowerPreview"
helpers:NavHelper.NavigateTo="views:PowerPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileExplorerPreview.png}" />
<!-- File Explorer Thumbnails -->
<NavigationViewItem
x:Uid="Shell_FileLocksmith"
helpers:NavHelper.NavigateTo="views:FileLocksmithPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileLocksmith.png}" />
<NavigationViewItem
x:Uid="Shell_ImageResizer"
helpers:NavHelper.NavigateTo="views:ImageResizerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ImageResizer.png}" />
<NavigationViewItem
x:Uid="NewPlus_Product_Name"
helpers:NavHelper.NavigateTo="views:NewPlusPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/NewPlus.png}" />
<NavigationViewItem
x:Uid="Shell_Peek"
helpers:NavHelper.NavigateTo="views:PeekPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Peek.png}" />
<NavigationViewItem
x:Uid="Shell_PowerRename"
helpers:NavHelper.NavigateTo="views:PowerRenamePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerRename.png}" />
<NavigationViewItem
x:Uid="Shell_InputOutputTopLevel"
Content="Input / Output"
ToolTipService.ToolTip="Input / Output"
Icon="Page2"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_KeyboardManager"
helpers:NavHelper.NavigateTo="views:KeyboardManagerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/KeyboardManager.png}" />
<!-- Find my mouse -->
<!-- Mouse Hightlighter -->
<NavigationViewItem
x:Uid="Shell_MouseUtilities"
helpers:NavHelper.NavigateTo="views:MouseUtilsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseUtils.png}" />
<NavigationViewItem
x:Uid="Shell_MouseWithoutBorders"
helpers:NavHelper.NavigateTo="views:MouseWithoutBordersPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/MouseWithoutBorders.png}" />
<NavigationViewItem
x:Uid="Shell_QuickAccent"
helpers:NavHelper.NavigateTo="views:PowerAccentPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/QuickAccent.png}" />
<!-- Mouse pointer cross hair -->
<NavigationViewItem
x:Uid="Shell_VideoConference"
helpers:NavHelper.NavigateTo="views:VideoConferencePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/VideoConferenceMute.png}"
IsEnabled="{x:Bind ViewModel.IsVideoConferenceBuild, Mode=OneWay}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>

<!-- File Management -->
<NavigationViewItem
x:Uid="Shell_FileManagementTopLevel"
Content="File Management"
ToolTipService.ToolTip="File Management"
Icon="Page2"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_PowerPreview"
helpers:NavHelper.NavigateTo="views:PowerPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileExplorerPreview.png}" />
<!-- File Explorer Thumbnails -->
<NavigationViewItem
x:Uid="Shell_FileLocksmith"
helpers:NavHelper.NavigateTo="views:FileLocksmithPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/FileLocksmith.png}" />
<NavigationViewItem
x:Uid="Shell_ImageResizer"
helpers:NavHelper.NavigateTo="views:ImageResizerPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/ImageResizer.png}" />
<NavigationViewItem
x:Uid="NewPlus_Product_Name"
helpers:NavHelper.NavigateTo="views:NewPlusPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/NewPlus.png}" />
<NavigationViewItem
x:Uid="Shell_Peek"
helpers:NavHelper.NavigateTo="views:PeekPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Peek.png}" />
<NavigationViewItem
x:Uid="Shell_PowerRename"
helpers:NavHelper.NavigateTo="views:PowerRenamePage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/PowerRename.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>
<!-- Advanced -->
<NavigationViewItem
x:Uid="Shell_CmdNotFound"
helpers:NavHelper.NavigateTo="views:CmdNotFoundPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CommandNotFound.png}" />
<NavigationViewItem
x:Uid="Shell_EnvironmentVariables"
helpers:NavHelper.NavigateTo="views:EnvironmentVariablesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/EnvironmentVariables.png}" />
<NavigationViewItem
x:Uid="Shell_Hosts"
helpers:NavHelper.NavigateTo="views:HostsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Hosts.png}" />
<NavigationViewItem
x:Uid="Shell_RegistryPreview"
helpers:NavHelper.NavigateTo="views:RegistryPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/RegistryPreview.png}" />
<NavigationViewItem
x:Uid="Shell_AdvancedTopLevel"
Content="Advanced"
ToolTipService.ToolTip="Advanced"
Icon="Page2"
SelectsOnInvoked="False">
<NavigationViewItem.MenuItems>
<NavigationViewItem
x:Uid="Shell_CmdNotFound"
helpers:NavHelper.NavigateTo="views:CmdNotFoundPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/CommandNotFound.png}" />
<NavigationViewItem
x:Uid="Shell_EnvironmentVariables"
helpers:NavHelper.NavigateTo="views:EnvironmentVariablesPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/EnvironmentVariables.png}" />
<NavigationViewItem
x:Uid="Shell_Hosts"
helpers:NavHelper.NavigateTo="views:HostsPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/Hosts.png}" />
<NavigationViewItem
x:Uid="Shell_RegistryPreview"
helpers:NavHelper.NavigateTo="views:RegistryPreviewPage"
Icon="{ui:BitmapIcon Source=/Assets/Settings/Icons/RegistryPreview.png}" />
</NavigationViewItem.MenuItems>
</NavigationViewItem>
</NavigationView.MenuItems>
<NavigationView.PaneFooter>
<StackPanel Orientation="Vertical">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private void OobeButton_Click(object sender, RoutedEventArgs e)

private bool navigationViewInitialStateProcessed; // avoid announcing initial state of the navigation pane.

private void NavigationView_PaneOpened(Microsoft.UI.Xaml.Controls.NavigationView sender, object args)
private void NavigationView_PaneOpened(NavigationView sender, object args)
{
if (!navigationViewInitialStateProcessed)
{
Expand All @@ -293,7 +293,7 @@ private void NavigationView_PaneOpened(Microsoft.UI.Xaml.Controls.NavigationView

if (AutomationPeer.ListenerExists(AutomationEvents.MenuOpened))
{
var loader = Helpers.ResourceLoaderInstance.ResourceLoader;
var loader = ResourceLoaderInstance.ResourceLoader;
peer.RaiseNotificationEvent(
AutomationNotificationKind.ActionCompleted,
AutomationNotificationProcessing.ImportantMostRecent,
Expand All @@ -302,7 +302,7 @@ private void NavigationView_PaneOpened(Microsoft.UI.Xaml.Controls.NavigationView
}
}

private void NavigationView_PaneClosed(Microsoft.UI.Xaml.Controls.NavigationView sender, object args)
private void NavigationView_PaneClosed(NavigationView sender, object args)
{
if (!navigationViewInitialStateProcessed)
{
Expand All @@ -318,7 +318,7 @@ private void NavigationView_PaneClosed(Microsoft.UI.Xaml.Controls.NavigationView

if (AutomationPeer.ListenerExists(AutomationEvents.MenuClosed))
{
var loader = Helpers.ResourceLoaderInstance.ResourceLoader;
var loader = ResourceLoaderInstance.ResourceLoader;
peer.RaiseNotificationEvent(
AutomationNotificationKind.ActionCompleted,
AutomationNotificationProcessing.ImportantMostRecent,
Expand Down
6 changes: 5 additions & 1 deletion src/settings-ui/Settings.UI/ViewModels/ShellViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,11 @@ private void OnItemInvoked(NavigationViewItemInvokedEventArgs args)
.OfType<NavigationViewItem>()
.First(menuItem => (string)menuItem.Content == (string)args.InvokedItem);
var pageType = item.GetValue(NavHelper.NavigateToProperty) as Type;
NavigationService.Navigate(pageType);

if (pageType != null)
{
NavigationService.Navigate(pageType);
}
}

private void OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
Expand Down

1 comment on commit 576ba90

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@check-spelling-bot Report

🔴 Please review

See the 📜action log or 📝 job summary for details.

Unrecognized words (1)

Hightlighter

Previously acknowledged words that are now absent applayout appsfolder buildtask cswinrt directshow DOPUS GBarm netcore nugets QDir SYSTEMSETTINGS SYSTEMWOW telem TOTALCMD USEPOSITION USESIZE winappdriver xplorer 🫥
To accept these unrecognized words as correct and remove the previously acknowledged and now absent words, you could run the following commands

... in a clone of the [email protected]:microsoft/PowerToys.git repository
on the dev/crutkas/newNav branch (ℹ️ how do I use this?):

curl -s -S -L 'https://raw.githubusercontent.com/check-spelling/check-spelling/v0.0.22/apply.pl' |
perl - 'https://github.com/microsoft/PowerToys/actions/runs/11489011774/attempts/1'
Available 📚 dictionaries could cover words (expected and unrecognized) not in the 📘 dictionary

This includes both expected items (1932) from .github/actions/spell-check/expect.txt and unrecognized words (1)

Dictionary Entries Covers Uniquely
cspell:r/src/r.txt 543 1 1
cspell:cpp/src/people.txt 23 1
cspell:cpp/src/ecosystem.txt 51 1

Consider adding them (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:

      with:
        extra_dictionaries:
          cspell:r/src/r.txt
          cspell:cpp/src/people.txt
          cspell:cpp/src/ecosystem.txt

To stop checking additional dictionaries, add (in .github/workflows/spelling2.yml) for uses: check-spelling/[email protected] in its with:

check_extra_dictionaries: ''
If the flagged items are 🤯 false positives

If items relate to a ...

  • binary file (or some other file you wouldn't want to check at all).

    Please add a file path to the excludes.txt file matching the containing file.

    File paths are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your files.

    ^ refers to the file's path from the root of the repository, so ^README\.md$ would exclude README.md (on whichever branch you're using).

  • well-formed pattern.

    If you can write a pattern that would match it,
    try adding it to the patterns.txt file.

    Patterns are Perl 5 Regular Expressions - you can test yours before committing to verify it will match your lines.

    Note that patterns can't match multiline strings.

Please sign in to comment.