devhome icon indicating copy to clipboard operation
devhome copied to clipboard

Reduce unneeded references to WinUIEx

Open nieubank opened this issue 9 months ago • 0 comments

Suggested new feature or improvement

WinUIEx is used heavily throughout Dev Home but most of the time it's to get access to the UI thread via the Dispatcher Queue of the MainWindow or using helper functions that are trivially implemented or callable via CsWin32.

It would be best if we could reduce the proliferation of dependencies on this third-party dependency and drive improvements to WinUI 3.0/WinAppSDK. I propose we remove all the global "using WinUIEx" to help better reduce unintentional usage of the extensions WinUIEx exposes and use native WinUI 3.0 functionality if we can.

For the Dispatcher Queue case, we can register the primary DispatcherQueue as a service and the few cases where the MainWindow is actually needed, rather than adding the WinUIEx as the service we can register the Microsoft.UI.Xaml.Window.

WinUIEx is still probably the best solution for minimum window size and window state persistence today, but most other use cases can be replaced with native alternatives.

Scenario

See commit

Additional details

No response

nieubank avatar May 15 '24 19:05 nieubank