From 3d214f4d78438cee032deb55ea530aac12602e1e Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sun, 19 Nov 2023 10:21:11 -0600 Subject: [PATCH] feat: provide ConfigureWindow for Uno --- Directory.Packages.props | 40 +++++++++---------- .../HelloWorld.Mobile.csproj | 1 - .../HelloWorld.Skia.Gtk.csproj | 1 - .../HelloWorld.Skia.Linux.FrameBuffer.csproj | 1 - .../HelloWorld.Skia.WPF.csproj | 1 - .../HelloWorld.Wasm/HelloWorld.Wasm.csproj | 1 - .../HelloWorld.Windows.csproj | 1 - e2e/Uno/HelloWorld/App.cs | 8 ++++ e2e/Uno/HelloWorld/HelloWorld.csproj | 2 +- .../Navigation/PageNavigationService.cs | 4 +- src/Uno/Prism.Uno/PrismApplicationBase.cs | 15 +++++++ 11 files changed, 46 insertions(+), 29 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 6c9997bc48..ae5949f185 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -15,38 +15,38 @@ - - - - - - - - - + + + + + + + + + - + - + - - + + - - - - - + + + + + - + @@ -77,6 +77,6 @@ - + diff --git a/e2e/Uno/HelloWorld.Mobile/HelloWorld.Mobile.csproj b/e2e/Uno/HelloWorld.Mobile/HelloWorld.Mobile.csproj index 060b086567..39a32b586f 100644 --- a/e2e/Uno/HelloWorld.Mobile/HelloWorld.Mobile.csproj +++ b/e2e/Uno/HelloWorld.Mobile/HelloWorld.Mobile.csproj @@ -32,7 +32,6 @@ - diff --git a/e2e/Uno/HelloWorld.Skia.Gtk/HelloWorld.Skia.Gtk.csproj b/e2e/Uno/HelloWorld.Skia.Gtk/HelloWorld.Skia.Gtk.csproj index c6eedbd9f5..2a11fac372 100644 --- a/e2e/Uno/HelloWorld.Skia.Gtk/HelloWorld.Skia.Gtk.csproj +++ b/e2e/Uno/HelloWorld.Skia.Gtk/HelloWorld.Skia.Gtk.csproj @@ -20,7 +20,6 @@ - diff --git a/e2e/Uno/HelloWorld.Skia.Linux.FrameBuffer/HelloWorld.Skia.Linux.FrameBuffer.csproj b/e2e/Uno/HelloWorld.Skia.Linux.FrameBuffer/HelloWorld.Skia.Linux.FrameBuffer.csproj index d3f67783ec..7fd8639462 100644 --- a/e2e/Uno/HelloWorld.Skia.Linux.FrameBuffer/HelloWorld.Skia.Linux.FrameBuffer.csproj +++ b/e2e/Uno/HelloWorld.Skia.Linux.FrameBuffer/HelloWorld.Skia.Linux.FrameBuffer.csproj @@ -20,7 +20,6 @@ - diff --git a/e2e/Uno/HelloWorld.Skia.WPF/HelloWorld.Skia.WPF.csproj b/e2e/Uno/HelloWorld.Skia.WPF/HelloWorld.Skia.WPF.csproj index 2e47db0a51..422d632d8f 100644 --- a/e2e/Uno/HelloWorld.Skia.WPF/HelloWorld.Skia.WPF.csproj +++ b/e2e/Uno/HelloWorld.Skia.WPF/HelloWorld.Skia.WPF.csproj @@ -29,7 +29,6 @@ - diff --git a/e2e/Uno/HelloWorld.Wasm/HelloWorld.Wasm.csproj b/e2e/Uno/HelloWorld.Wasm/HelloWorld.Wasm.csproj index 2df461c00c..c392c4c9a3 100644 --- a/e2e/Uno/HelloWorld.Wasm/HelloWorld.Wasm.csproj +++ b/e2e/Uno/HelloWorld.Wasm/HelloWorld.Wasm.csproj @@ -56,7 +56,6 @@ - diff --git a/e2e/Uno/HelloWorld.Windows/HelloWorld.Windows.csproj b/e2e/Uno/HelloWorld.Windows/HelloWorld.Windows.csproj index 959a8ac7d4..b80cf72bc5 100644 --- a/e2e/Uno/HelloWorld.Windows/HelloWorld.Windows.csproj +++ b/e2e/Uno/HelloWorld.Windows/HelloWorld.Windows.csproj @@ -35,7 +35,6 @@ - diff --git a/e2e/Uno/HelloWorld/App.cs b/e2e/Uno/HelloWorld/App.cs index e14f6eb972..cd54d6da55 100644 --- a/e2e/Uno/HelloWorld/App.cs +++ b/e2e/Uno/HelloWorld/App.cs @@ -1,5 +1,6 @@ using HelloWorld.Views; using ModuleA; +using Uno.UI; namespace HelloWorld; @@ -35,6 +36,13 @@ protected override void ConfigureHost(IHostBuilder builder) }); } + protected override void ConfigureWindow(Window window) + { +#if DEBUG + window.EnableHotReload(); +#endif + } + protected override void RegisterTypes(IContainerRegistry containerRegistry) { // Register types with the container or for Navigation diff --git a/e2e/Uno/HelloWorld/HelloWorld.csproj b/e2e/Uno/HelloWorld/HelloWorld.csproj index 180b7e5d45..5f34fc1c69 100644 --- a/e2e/Uno/HelloWorld/HelloWorld.csproj +++ b/e2e/Uno/HelloWorld/HelloWorld.csproj @@ -11,7 +11,6 @@ - @@ -19,6 +18,7 @@ + diff --git a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs index f7d0b49e40..1ad5afbd2c 100644 --- a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs +++ b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs @@ -345,7 +345,7 @@ protected virtual async Task ProcessNavigation(Page currentPage, Queue s animated = parameters.ContainsKey(KnownNavigationParameters.Animated) ? parameters.GetValue(KnownNavigationParameters.Animated) : - pageParameters.ContainsKey(KnownNavigationParameters.Animated) ? pageParameters.GetValue(KnownNavigationParameters.Animated) : true; + pageParameters.ContainsKey(KnownNavigationParameters.Animated) ? pageParameters.GetValue(KnownNavigationParameters.Animated) : true; if (nextSegment == RemovePageSegment) { @@ -837,7 +837,7 @@ async Task ConfigureTabbedPage(TabbedPage tabbedPage, string segment, INavigatio { var tabSegment = tabSegments[i]; var child = CreatePageFromSegment(tabSegment); - var childParameters = UriParsingHelper.GetSegmentParameters(tabSegment, parameters); + var childParameters = UriParsingHelper.GetSegmentParameters(tabSegment, parameters); if (i == 0 && child is NavigationPage navPage) { navigationPage = navPage; diff --git a/src/Uno/Prism.Uno/PrismApplicationBase.cs b/src/Uno/Prism.Uno/PrismApplicationBase.cs index 7330abd959..71dba9e1a7 100755 --- a/src/Uno/Prism.Uno/PrismApplicationBase.cs +++ b/src/Uno/Prism.Uno/PrismApplicationBase.cs @@ -88,6 +88,20 @@ protected virtual void ConfigureApp(IApplicationBuilder builder) { } /// The . protected virtual void ConfigureHost(IHostBuilder builder) { } + /// + /// Provides an opportunity to initialize services or otherwise prepare the application Window. + /// + /// The primary application + /// + /// protected override void ConfigureWindow(Window window) + /// { + /// #if DEBUG + /// window.EnableHotReload(); + /// #endif + /// } + /// + protected virtual void ConfigureWindow(Window window) { } + /// /// Register Services with the . /// @@ -104,6 +118,7 @@ protected virtual void ConfigureServices(IServiceCollection services) { } protected virtual void Initialize(IApplicationBuilder builder) { ConfigureApp(builder); + ConfigureWindow(builder.Window); builder.Configure(ConfigureHost) .Configure(x => x.ConfigureServices(ConfigureServices) .UseServiceProviderFactory(new PrismServiceProviderFactory(_containerExtension)));