Skip to content

Commit

Permalink
feat: provide ConfigureWindow for Uno
Browse files Browse the repository at this point in the history
  • Loading branch information
dansiegel committed Nov 19, 2023
1 parent 6bd895d commit 3d214f4
Show file tree
Hide file tree
Showing 11 changed files with 46 additions and 29 deletions.
40 changes: 20 additions & 20 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -15,38 +15,38 @@
</ItemGroup>
<!-- Uno -->
<ItemGroup Condition=" $(IsUnoProject) == 'true' ">
<PackageVersion Include="Uno.WinUI" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Skia.Linux.FrameBuffer" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.Skia.Wpf" Version="5.0.19" />
<PackageVersion Include="Uno.Wasm.Bootstrap" Version="8.0.0" />
<PackageVersion Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.0" />
<PackageVersion Include="Uno.WinUI.WebAssembly" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI.DevServer" Version="5.0.19" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.19" />
<PackageVersion Include="Uno.WinUI" Version="5.0.48" />
<PackageVersion Include="Uno.WinUI.Skia.Gtk" Version="5.0.48" />
<PackageVersion Include="Uno.WinUI.Skia.Linux.FrameBuffer" Version="5.0.48" />
<PackageVersion Include="Uno.WinUI.Skia.Wpf" Version="5.0.48" />
<PackageVersion Include="Uno.Wasm.Bootstrap" Version="8.0.4" />
<PackageVersion Include="Uno.Wasm.Bootstrap.DevServer" Version="8.0.4" />
<PackageVersion Include="Uno.WinUI.WebAssembly" Version="5.0.48" />
<PackageVersion Include="Uno.WinUI.DevServer" Version="5.0.48" />
<PackageVersion Include="Uno.UI.Adapter.Microsoft.Extensions.Logging" Version="5.0.48" />
<PackageVersion Include="Uno.Core" Version="4.0.1" />
<PackageVersion Include="Uno.Core.Extensions.Logging.Singleton" Version="4.0.1" />
<PackageVersion Include="Uno.Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.4.2" />
<PackageVersion Include="Microsoft.Xaml.Behaviors.WinUI.Managed" Version="2.0.9" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.2.221109.1" Condition="$(MSBuildProjectName.Contains('Prism'))" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231008000" Condition="!$(MSBuildProjectName.Contains('Prism'))" />
<PackageVersion Include="Microsoft.WindowsAppSDK" Version="1.4.231115000" Condition="!$(MSBuildProjectName.Contains('Prism'))" />
<PackageVersion Include="Microsoft.Windows.SDK.BuildTools" Version="10.0.22621.2428" />
<PackageVersion Include="SkiaSharp.Views.Uno.WinUI" Version="2.88.6" />
<PackageVersion Include="SkiaSharp.Skottie" Version="2.88.6" />
<PackageVersion Include="Uno.Resizetizer" Version="1.2.0" />
<PackageVersion Include="Uno.Resizetizer" Version="1.2.1" />
<PackageVersion Include="Uno.Extensions.Core" Version="3.0.10" />
<PackageVersion Include="Uno.Extensions.Logging.OSLog" Version="1.7.0" />
<PackageVersion Include="Uno.Extensions.Logging.WinUI" Version="3.0.10" />
<PackageVersion Include="Uno.Extensions.Logging.Serilog" Version="3.0.10" />
<PackageVersion Include="Uno.Extensions.Logging.WinUI" Version="3.0.11" />
<PackageVersion Include="Uno.Extensions.Logging.Serilog" Version="3.0.11" />
<PackageVersion Include="Uno.Extensions.Logging.WebAssembly.Console" Version="1.7.0" />
<PackageVersion Include="Uno.Material.WinUI" Version="4.0.4" />
<PackageVersion Include="Uno.Toolkit.WinUI.Material" Version="5.0.15" />
<PackageVersion Include="Uno.Toolkit.WinUI" Version="5.0.15" />
<PackageVersion Include="Uno.Extensions.Hosting.WinUI" Version="3.0.10" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="7.0.0" />
<PackageVersion Include="Uno.Material.WinUI" Version="4.0.6" />
<PackageVersion Include="Uno.Toolkit.WinUI.Material" Version="5.0.17" />
<PackageVersion Include="Uno.Toolkit.WinUI" Version="5.0.17" />
<PackageVersion Include="Uno.Extensions.Hosting.WinUI" Version="3.0.11" />
<PackageVersion Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageVersion Include="Xamarin.Google.Android.Material" Version="1.10.0.1" />
<PackageVersion Include="Uno.UniversalImageLoader" Version="1.9.36" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="7.0.5" />
<PackageVersion Include="Microsoft.Windows.Compatibility" Version="8.0.0" />
</ItemGroup>
<!-- Tests -->
<ItemGroup>
Expand Down Expand Up @@ -77,6 +77,6 @@
<!-- Global Packages -->
<PackageVersion Include="Microsoft.NETFramework.ReferenceAssemblies" Version="1.0.3" />
<PackageVersion Include="Nerdbank.GitVersioning" Version="3.6.133" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="1.1.1" />
<PackageVersion Include="Microsoft.SourceLink.GitHub" Version="8.0.0" />
</ItemGroup>
</Project>
1 change: 0 additions & 1 deletion e2e/Uno/HelloWorld.Mobile/HelloWorld.Mobile.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
<PackageReference Include="Uno.Extensions.Logging.OSLog" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Extensions.Core" />
</ItemGroup>
<Choose>
<When Condition="$(IsAndroid)">
Expand Down
1 change: 0 additions & 1 deletion e2e/Uno/HelloWorld.Skia.Gtk/HelloWorld.Skia.Gtk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<PackageReference Include="Uno.Extensions.Hosting.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Extensions.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HelloWorld\HelloWorld.csproj" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
<PackageReference Include="Uno.Extensions.Hosting.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Extensions.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HelloWorld\HelloWorld.csproj" />
Expand Down
1 change: 0 additions & 1 deletion e2e/Uno/HelloWorld.Skia.WPF/HelloWorld.Skia.WPF.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
<PackageReference Include="Uno.Extensions.Hosting.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Extensions.Core" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="Wpf\App.xaml" XamlRuntime="Wpf" />
Expand Down
1 change: 0 additions & 1 deletion e2e/Uno/HelloWorld.Wasm/HelloWorld.Wasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
<PackageReference Include="Uno.Extensions.Logging.WebAssembly.Console" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Extensions.Core" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\HelloWorld\HelloWorld.csproj" />
Expand Down
1 change: 0 additions & 1 deletion e2e/Uno/HelloWorld.Windows/HelloWorld.Windows.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
<PackageReference Include="Uno.Extensions.Hosting.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Extensions.Core" />
</ItemGroup>

<ItemGroup>
Expand Down
8 changes: 8 additions & 0 deletions e2e/Uno/HelloWorld/App.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using HelloWorld.Views;
using ModuleA;
using Uno.UI;

namespace HelloWorld;

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion e2e/Uno/HelloWorld/HelloWorld.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
<ItemGroup>
<PackageReference Include="Uno.WinUI" />
<PackageReference Include="Uno.Resizetizer" />
<PackageReference Include="Uno.Extensions.Core" />
<PackageReference Include="Uno.Extensions.Logging.WinUI" />
<PackageReference Include="Uno.Extensions.Logging.Serilog" />
<PackageReference Include="Uno.Material.WinUI" />
<PackageReference Include="Uno.Toolkit.WinUI.Material" />
<PackageReference Include="Uno.Toolkit.WinUI" />
<PackageReference Include="Uno.Extensions.Hosting.WinUI" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" />
<PackageReference Include="Uno.WinUI.DevServer" Condition=" $(Configuration) == 'Debug' " />
</ItemGroup>

<Choose>
Expand Down
4 changes: 2 additions & 2 deletions src/Maui/Prism.Maui/Navigation/PageNavigationService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ protected virtual async Task ProcessNavigation(Page currentPage, Queue<string> s

animated = parameters.ContainsKey(KnownNavigationParameters.Animated) ?
parameters.GetValue<bool>(KnownNavigationParameters.Animated) :
pageParameters.ContainsKey(KnownNavigationParameters.Animated) ? pageParameters.GetValue<bool>(KnownNavigationParameters.Animated) : true;
pageParameters.ContainsKey(KnownNavigationParameters.Animated) ? pageParameters.GetValue<bool>(KnownNavigationParameters.Animated) : true;

if (nextSegment == RemovePageSegment)
{
Expand Down Expand Up @@ -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;
Expand Down
15 changes: 15 additions & 0 deletions src/Uno/Prism.Uno/PrismApplicationBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,20 @@ protected virtual void ConfigureApp(IApplicationBuilder builder) { }
/// <param name="builder">The <see cref="IHostBuilder" />.</param>
protected virtual void ConfigureHost(IHostBuilder builder) { }

/// <summary>
/// Provides an opportunity to initialize services or otherwise prepare the application Window.
/// </summary>
/// <param name="window">The primary application <see cref="Window"/></param>
/// <example>
/// protected override void ConfigureWindow(Window window)
/// {
/// #if DEBUG
/// window.EnableHotReload();
/// #endif
/// }
/// </example>
protected virtual void ConfigureWindow(Window window) { }

/// <summary>
/// Register Services with the <see cref="IServiceCollection" />.
/// </summary>
Expand All @@ -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)));
Expand Down

0 comments on commit 3d214f4

Please sign in to comment.