From 1d8fbbb62cde62c81fa6d2bae5318de295c0dbef Mon Sep 17 00:00:00 2001 From: James Montemagno Date: Thu, 24 Mar 2022 10:31:17 -0700 Subject: [PATCH] Update registration of pages --- src/Mobile/MauiProgram.cs | 9 --------- src/Mobile/Pages/PagesExtensions.cs | 10 +++++++++- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/src/Mobile/MauiProgram.cs b/src/Mobile/MauiProgram.cs index c87c666..5e70769 100644 --- a/src/Mobile/MauiProgram.cs +++ b/src/Mobile/MauiProgram.cs @@ -25,15 +25,6 @@ public static class MauiProgram Barrel.ApplicationId = "dotnetpodcasts"; - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); - builder.Services.AddTransient(); return builder.Build(); } diff --git a/src/Mobile/Pages/PagesExtensions.cs b/src/Mobile/Pages/PagesExtensions.cs index deea318..f7d784d 100644 --- a/src/Mobile/Pages/PagesExtensions.cs +++ b/src/Mobile/Pages/PagesExtensions.cs @@ -1,15 +1,23 @@ -namespace Microsoft.NetConf2021.Maui.Pages; +namespace Microsoft.NetConf2021.Maui.Pages; public static class PagesExtensions { public static MauiAppBuilder ConfigurePages(this MauiAppBuilder builder) { + // main tabs of the app builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); builder.Services.AddSingleton(); + // pages that are navigated to + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + builder.Services.AddTransient(); + return builder; } }