-
Notifications
You must be signed in to change notification settings - Fork 7.6k
[cmdpal] Implement GotoPage #38025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
[cmdpal] Implement GotoPage #38025
Conversation
This file contains hidden or 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
…l object so even if we create a new wrapper we'll compare it against what it actually contains.
Just some minor clean-up/perf things I was trying, doesn't actually fix anything though, unfortunately (outside of maybe making startup a bit faster)... Does NOT fix zadjii-msft#213 We were effectively getting called to load images twice in a few spots, and we were trying to load them everywhere at startup. This minimized that in a few places, but we can't use x:Phase in the DataTemplate for the List Items (as it needs a UIElement), so that caused some issues. I thought I had a fix for all the duplicate items loading on the home page, but alas no. Have to continue digging into that, but got side-tracked by the above.
This allows extension objects to write error messages specifically to the page that owns them. We don't need the `ShowExceptionMessage` anymore, because that just tossed the error at whatever page was open (even if it wasn't the page that had an error). I also made this a `IPageContext`, rather than `IErrorContext`, so we could pass the page's task scheduler to that object too. That lets us have one base `UpdateProperties` implementation for all extension objects. I think this sneakily also adds support for `Page.Title` (separate from `Page.Name`) Closes #203
…t rebuild every launch
…w an exception, that makes sense
Replaces PR #218 IconBox is a custom control that's a ContentControl, it's generic (toolkitable) and should be able to be styled and templated. It knows how to take an IconSource and create the underlying IconElement as its content. It can also take any general value as a `SourceKey` and via an implementation of the SourceRequested event, translate a bound general object into the `IconSource` required. This is how caching can be provided by an application as well, for instance (like we'll do here). This uses the deferred events pattern to await the call to the `SourceRequested` event which may need to load data asynchronously We create a static x:Bind helper `IconCacheProvider` to encapsulate our shared logic for our eventual Icon cache. Renamed IconCacheService.xaml.cs -> IconCacheService.cs Removed old broken behavior (believe ultimate issue was due to instability in loaded/unloaded events, i.e. issue microsoft/microsoft-ui-xaml#1900) XAML Styler also did its thing...
Fixes #213 Replaces PR #218 FYI @Ryken100 (thanks for the info and assist in debugging the issue and discussing possible avenues of resolution) Thanks @zadjii-msft for validating the end path in #218 Before: ```xml <Border x:Name="IconBorder" Grid.Column="0" Width="16" Height="16" Margin="0,0,0,0"> <!-- LoadIconBehavior will magically fill this border up with an icon --> <Interactivity:Interaction.Behaviors> <cmdpalUI:LoadIconBehavior Source="{x:Bind Icon, Mode=OneWay}"/> </Interactivity:Interaction.Behaviors> </Border> ``` After: ```xml <cpcontrols:IconBox Grid.Column="0" Width="16" Height="16" Margin="0,0,0,0" SourceKey="{x:Bind Icon, Mode=OneWay}" SourceRequested="{x:Bind help:IconCacheProvider.SourceRequested}" /> ``` The IconCacheProvider is the translation layer between having a light-weight control and our specific app's logic/desire for an icon cache, using the deferred event pattern: ```cs public static partial class IconCacheProvider { private static readonly IconCacheService IconService = new(Microsoft.UI.Dispatching.DispatcherQueue.GetForCurrentThread()); public static async void SourceRequested(IconBox sender, SourceRequestedEventArgs args) { if (args.Key == null) { return; } if (args.Key is IconDataType iconData) { var deferral = args.GetDeferral(); args.Value = await IconService.GetIconSource(iconData); deferral.Complete(); } } } ``` ## Details `IconBox` is a custom control that's a ContentControl, its generic (toolkitable) and should be able to be styled and templated (haven't tested, but no reason it shouldn't as a XAML `ContentControl`, should help @niels9001 a ton). It knows how to take an `IconSource` and create the underlying `IconElement` as its content. It can also take any general value as a `SourceKey` and via an implementation of the `SourceRequested` event, translate a bound general object into the `IconSource` required. This is how caching can be provided by an application as well, for instance (like we'll do here). This uses the deferred events pattern to await the call to the `SourceRequested` event which may need to load data asynchronously We create a static x:Bind helper `IconCacheProvider` to encapsulate our shared logic for our eventual Icon cache. Also: - Renamed IconCacheService.xaml.cs -> IconCacheService.cs - Removed old broken behavior (believe ultimate issue was due to instability in loaded/unloaded events, i.e. issue microsoft/microsoft-ui-xaml#1900) - XAML Styler also did its thing... (some conflict here in config from PowerToys to resolve later, imagine this is also a consequence of us not having CI setup in fork...)
Migrate Window Walker from PT Run
Get the other two types of pages back in. Form pages and Markdown pages.  When forms fail to parse, we'll display the exception by replacing the card with one of our one authoring  Markdown pages support multiple bodies, and possibly details:   Ref #73
Update the idl to allow us to specify separate FG and BG colors. I think that's better honestly.
Contributor
Author
|
@zadjii |
Contributor
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
zadjii-msft
requested changes
Mar 24, 2025
Member
zadjii-msft
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I haven't taken the full time to review this, but I thought we should hold this one out of 0.90 and ship this in the next release. We don't really have the runway left to validate all the scenarios for this one.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary of the Pull Request
Implement the GotoPage to make extension can control their work flow.
demo here (sorry for misunderstanding before, I recreate a new one to meet the docs definition):
Video.Project.10.mp4
limitation:
If we want to support all pages in the future, we need to add a location to make extensions register their page which they want to jump to.
If not, we may trap in recursion (such as the SampleGotoPage in this PR).
PR Checklist
Detailed Description of the Pull Request / Additional comments
Validation Steps Performed