From 84cbb447eab50bbcdbcb654c1eb263036de4d174 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Tue, 22 Aug 2023 10:42:08 -0600 Subject: [PATCH 01/19] feat: migrate Regions to core --- .../Prism.Forms.Regions/Common/MvvmHelpers.cs | 8 +- .../Prism.Forms.Regions.csproj | 7 +- .../Adapters/CarouselViewRegionAdapter.cs | 2 +- .../Regions/AllActiveRegion.cs | 3 +- .../Behaviors/AutoPopulateRegionBehavior.cs | 3 +- .../ClearChildViewsRegionBehavior.cs | 3 +- .../Regions/Behaviors/IRegionBehavior.cs | 20 --- .../Behaviors/IRegionBehaviorCollection.cs | 33 ---- .../Behaviors/IRegionBehaviorFactory.cs | 36 ----- .../Behaviors/RegionActiveAwareBehavior.cs | 2 +- .../Regions/Behaviors/RegionBehavior.cs | 54 ------- .../Behaviors/RegionBehaviorCollection.cs | 80 ---------- .../Behaviors/RegionBehaviorFactory.cs | 99 ------------ .../Regions/INavigationServiceAware.cs | 5 +- .../Prism.Forms.Regions/Regions/IRegion.cs | 118 -------------- .../Regions/IRegionCollection.cs | 49 ------ .../Regions/IRegionManager.cs | 76 --------- .../Regions/IRegionManagerExtensions.cs | 123 --------------- .../Regions/IViewsCollection.cs | 11 -- .../IConfirmRegionNavigationRequest.cs | 21 --- .../Regions/Navigation/IJournalAware.cs | 14 -- .../Regions/Navigation/INavigateAsync.cs | 38 ----- .../Regions/Navigation/INavigationContext.cs | 44 ------ .../IRegionNavigationContentLoader.cs | 23 --- .../IRegionNavigationJournalEntry.cs | 22 --- .../Navigation/IRegionNavigationResult.cs | 28 ---- .../Navigation/IRegionNavigationService.cs | 37 ----- .../Navigation/NavigationAsyncExtensions.cs | 104 ------------- .../Regions/Navigation/NavigationContext.cs | 70 --------- .../RegionNavigationContentLoader.cs | 8 +- .../Navigation/RegionNavigationJournal.cs | 147 ------------------ .../RegionNavigationJournalEntry.cs | 39 ----- .../Navigation/RegionNavigationResult.cs | 51 ------ .../Navigation/RegionNavigationService.cs | 46 +++--- .../Prism.Forms.Regions/Regions/Region.cs | 48 ++++-- .../Regions/RegionManager.cs | 39 +++-- .../Regions/SingleActiveRegion.cs | 3 +- .../Regions/ViewRegisteredEventArgs.cs | 31 ---- .../Regions/ViewsCollection.cs | 4 +- src/Maui/Prism.Maui/Common/MvvmHelpers.cs | 7 +- .../RegionNavigationRegistrationExtensions.cs | 3 + .../Internals/ChildRegionCollection.cs | 1 + src/Maui/Prism.Maui/PrismAppBuilder.cs | 6 +- .../Adapters/CarouselViewRegionAdapter.cs | 2 +- .../Prism.Maui/Regions/AllActiveRegion.cs | 7 +- .../ClearChildViewsRegionBehavior.cs | 2 +- .../Regions/Behaviors/IRegionBehavior.cs | 17 -- .../Behaviors/IRegionBehaviorCollection.cs | 30 ---- .../Behaviors/IRegionBehaviorFactory.cs | 32 ---- .../Behaviors/RegionActiveAwareBehavior.cs | 2 +- .../Regions/Behaviors/RegionBehavior.cs | 52 ------- .../Behaviors/RegionBehaviorCollection.cs | 77 --------- .../Behaviors/RegionBehaviorFactory.cs | 96 ------------ src/Maui/Prism.Maui/Regions/IRegion.cs | 117 -------------- .../Prism.Maui/Regions/IRegionCollection.cs | 45 ------ src/Maui/Prism.Maui/Regions/IRegionManager.cs | 74 --------- .../Regions/IRegionManagerExtensions.cs | 4 +- .../Prism.Maui/Regions/IRegionViewRegistry.cs | 46 ------ .../Prism.Maui/Regions/IViewsCollection.cs | 8 - .../IConfirmRegionNavigationRequest.cs | 18 --- .../Regions/Navigation/IJournalAware.cs | 13 -- .../Regions/Navigation/INavigateAsync.cs | 36 ----- .../Regions/Navigation/INavigationContext.cs | 27 ---- .../INavigationContextExtensions.cs | 15 -- .../Regions/Navigation/IRegionAware.cs | 28 ---- .../IRegionNavigationContentLoader.cs | 20 --- .../Navigation/IRegionNavigationJournal.cs | 60 ------- .../IRegionNavigationJournalEntry.cs | 20 --- .../Navigation/IRegionNavigationResult.cs | 25 --- .../Navigation/IRegionNavigationService.cs | 34 ---- .../Navigation/NavigationAsyncExtensions.cs | 4 +- .../Regions/Navigation/NavigationContext.cs | 67 -------- .../RegionNavigationContentLoader.cs | 7 +- .../Navigation/RegionNavigationEventArgs.cs | 31 ---- .../RegionNavigationFailedEventArgs.cs | 48 ------ .../Navigation/RegionNavigationJournal.cs | 143 ----------------- .../RegionNavigationJournalEntry.cs | 37 ----- .../Navigation/RegionNavigationResult.cs | 48 ------ .../Navigation/RegionNavigationService.cs | 38 ++--- src/Maui/Prism.Maui/Regions/Region.cs | 50 ++++-- src/Maui/Prism.Maui/Regions/RegionManager.cs | 39 ++++- .../Regions/RegionMemberLifetimeAttribute.cs | 26 ---- .../Prism.Maui/Regions/RegionViewRegistry.cs | 1 + .../Prism.Maui/Regions/SingleActiveRegion.cs | 6 +- .../Regions/SyncActiveStateAttribute.cs | 9 -- .../Regions/UpdateRegionsException.cs | 48 ------ .../Regions/ViewRegisteredEventArgs.cs | 30 ---- .../Regions/ViewRegistrationException.cs | 53 ------- .../Regions/ViewSortHintAttribute.cs | 23 --- .../Prism.Maui/Regions/ViewsCollection.cs | 8 +- .../Properties/Resources.Designer.cs | 36 +++++ src/Prism.Core/Properties/Resources.resx | 12 ++ .../Regions/IConfirmNavigationRequest.cs | 2 +- .../Regions/IJournalAware.cs | 0 .../Regions/INavigateAsync.cs | 11 -- .../Regions/IRegion.cs | 14 +- .../Regions/IRegionAdapter.cs | 3 - .../Regions}/IRegionAware.cs | 8 +- .../Regions/IRegionBehavior.cs | 2 - .../Regions/IRegionBehaviorCollection.cs | 2 - .../Regions/IRegionBehaviorFactory.cs | 5 +- .../IRegionBehaviorFactoryExtensions.cs | 11 ++ .../Regions/IRegionCollection.cs | 2 - .../Regions/IRegionManager.cs | 58 +------ .../Regions/IRegionManagerExtensions.cs | 104 +++++++++++++ .../Regions/IRegionMemberLifetime.cs | 4 +- .../Regions/IRegionNavigationContentLoader.cs | 2 - .../Regions}/IRegionNavigationJournal.cs | 4 +- .../Regions/IRegionNavigationJournalEntry.cs | 0 .../Regions/IRegionNavigationRegistry.cs | 0 .../Regions/IRegionNavigationService.cs | 2 - .../Regions/IRegionViewRegistry.cs | 16 +- .../Regions/IViewsCollection.cs | 2 - .../Regions/NavigationAsyncExtensions.cs | 13 ++ .../Regions/NavigationContext.cs | 0 .../Regions/NavigationContextExtensions.cs | 23 +++ .../Regions/NavigationResult.cs | 12 +- .../Regions/RegionBehavior.cs | 2 - .../Regions/RegionBehaviorCollection.cs | 28 +--- .../Regions/RegionBehaviorFactory.cs | 1 - .../Regions/RegionCreationException.cs | 33 ++++ src/Prism.Core/Regions/RegionException.cs | 30 ++++ .../Regions/RegionMemberLifetimeAttribute.cs | 5 +- .../Regions}/RegionNavigationEventArgs.cs | 10 +- .../RegionNavigationFailedEventArgs.cs | 12 +- .../Regions/RegionNavigationJournal.cs | 2 - .../Regions/RegionNavigationJournalEntry.cs | 0 .../Regions/RegionViewRegistryExtensions.cs | 30 ++++ .../Regions/SyncActiveStateAttribute.cs | 0 .../Regions/UpdateRegionsException.cs | 14 +- .../Regions/ViewRegisteredEventArgs.cs | 7 +- .../Regions/ViewRegistrationException.cs | 13 +- .../Regions/ViewSortHintAttribute.cs | 0 src/Wpf/Prism.Wpf/Properties/Resources.resx | 12 -- .../Behaviors/AutoPopulateRegionBehavior.cs | 3 +- src/Wpf/Prism.Wpf/Regions/INavigationAware.cs | 29 +--- .../Regions/IRegionManagerAccessor.cs | 2 - .../Regions/IRegionManagerExtensions.cs | 20 --- .../Regions/IRegionNavigationJournal.cs | 72 --------- src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs | 16 +- src/Wpf/Prism.Wpf/Regions/RegionManager.cs | 70 +-------- .../Regions/RegionNavigationContentLoader.cs | 4 +- .../Regions/RegionNavigationEventArgs.cs | 50 ------ .../RegionNavigationFailedEventArgs.cs | 67 -------- .../Regions/RegionNavigationService.cs | 4 +- .../Prism.Wpf/Regions/RegionViewRegistry.cs | 26 +++- .../Regions/UpdateRegionsException.Desktop.cs | 22 --- .../ViewRegistrationException.Desktop.cs | 23 --- src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs | 2 - 149 files changed, 635 insertions(+), 3511 deletions(-) delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehavior.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorCollection.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorFactory.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehavior.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorCollection.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorFactory.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/IRegion.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/IRegionCollection.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/IRegionManager.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/IRegionManagerExtensions.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/IViewsCollection.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/IConfirmRegionNavigationRequest.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/IJournalAware.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigateAsync.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigationContext.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationContentLoader.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationJournalEntry.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationResult.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationService.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationAsyncExtensions.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationContext.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournal.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournalEntry.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationResult.cs delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/ViewRegisteredEventArgs.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehavior.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorCollection.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorFactory.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Behaviors/RegionBehavior.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorCollection.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorFactory.cs delete mode 100644 src/Maui/Prism.Maui/Regions/IRegion.cs delete mode 100644 src/Maui/Prism.Maui/Regions/IRegionCollection.cs delete mode 100644 src/Maui/Prism.Maui/Regions/IRegionManager.cs delete mode 100644 src/Maui/Prism.Maui/Regions/IRegionViewRegistry.cs delete mode 100644 src/Maui/Prism.Maui/Regions/IViewsCollection.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IConfirmRegionNavigationRequest.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IJournalAware.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/INavigateAsync.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/INavigationContext.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/INavigationContextExtensions.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IRegionAware.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationContentLoader.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournal.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournalEntry.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationResult.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationService.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/NavigationContext.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationEventArgs.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationFailedEventArgs.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournal.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournalEntry.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationResult.cs delete mode 100644 src/Maui/Prism.Maui/Regions/RegionMemberLifetimeAttribute.cs delete mode 100644 src/Maui/Prism.Maui/Regions/SyncActiveStateAttribute.cs delete mode 100644 src/Maui/Prism.Maui/Regions/UpdateRegionsException.cs delete mode 100644 src/Maui/Prism.Maui/Regions/ViewRegisteredEventArgs.cs delete mode 100644 src/Maui/Prism.Maui/Regions/ViewRegistrationException.cs delete mode 100644 src/Maui/Prism.Maui/Regions/ViewSortHintAttribute.cs rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IConfirmNavigationRequest.cs (92%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IJournalAware.cs (100%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/INavigateAsync.cs (66%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegion.cs (92%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionAdapter.cs (99%) rename src/{Forms/Prism.Forms.Regions/Regions/Navigation => Prism.Core/Regions}/IRegionAware.cs (79%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionBehavior.cs (99%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionBehaviorCollection.cs (99%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionBehaviorFactory.cs (89%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionBehaviorFactoryExtensions.cs (61%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionCollection.cs (99%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionManager.cs (54%) create mode 100644 src/Prism.Core/Regions/IRegionManagerExtensions.cs rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionMemberLifetime.cs (81%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionNavigationContentLoader.cs (99%) rename src/{Forms/Prism.Forms.Regions/Regions/Navigation => Prism.Core/Regions}/IRegionNavigationJournal.cs (93%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionNavigationJournalEntry.cs (100%) rename src/{Maui/Prism.Maui => Prism.Core}/Regions/IRegionNavigationRegistry.cs (100%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionNavigationService.cs (99%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IRegionViewRegistry.cs (64%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/IViewsCollection.cs (99%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/NavigationAsyncExtensions.cs (85%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/NavigationContext.cs (100%) create mode 100644 src/Prism.Core/Regions/NavigationContextExtensions.cs rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/NavigationResult.cs (89%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/RegionBehavior.cs (99%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/RegionBehaviorCollection.cs (84%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/RegionBehaviorFactory.cs (96%) create mode 100644 src/Prism.Core/Regions/RegionCreationException.cs create mode 100644 src/Prism.Core/Regions/RegionException.cs rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/RegionMemberLifetimeAttribute.cs (86%) rename src/{Forms/Prism.Forms.Regions/Regions/Navigation => Prism.Core/Regions}/RegionNavigationEventArgs.cs (78%) rename src/{Forms/Prism.Forms.Regions/Regions/Navigation => Prism.Core/Regions}/RegionNavigationFailedEventArgs.cs (80%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/RegionNavigationJournal.cs (99%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/RegionNavigationJournalEntry.cs (100%) create mode 100644 src/Prism.Core/Regions/RegionViewRegistryExtensions.cs rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/SyncActiveStateAttribute.cs (100%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/UpdateRegionsException.cs (65%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/ViewRegisteredEventArgs.cs (82%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/ViewRegistrationException.cs (70%) rename src/{Wpf/Prism.Wpf => Prism.Core}/Regions/ViewSortHintAttribute.cs (100%) delete mode 100644 src/Wpf/Prism.Wpf/Regions/IRegionManagerExtensions.cs delete mode 100644 src/Wpf/Prism.Wpf/Regions/IRegionNavigationJournal.cs delete mode 100644 src/Wpf/Prism.Wpf/Regions/RegionNavigationEventArgs.cs delete mode 100644 src/Wpf/Prism.Wpf/Regions/RegionNavigationFailedEventArgs.cs delete mode 100644 src/Wpf/Prism.Wpf/Regions/UpdateRegionsException.Desktop.cs delete mode 100644 src/Wpf/Prism.Wpf/Regions/ViewRegistrationException.Desktop.cs diff --git a/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs b/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs index 3d7f8a5848..b944a86280 100644 --- a/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs +++ b/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs @@ -1,5 +1,5 @@ using System; -using Prism.Regions.Navigation; +using Prism.Regions; using Xamarin.Forms; namespace Prism.Common @@ -34,7 +34,7 @@ public static T GetImplementerFromViewOrViewModel(object view) return null; } - public static bool IsNavigationTarget(object view, INavigationContext navigationContext) + public static bool IsNavigationTarget(object view, NavigationContext navigationContext) { if (view is IRegionAware viewAsRegionAware) { @@ -55,12 +55,12 @@ public static bool IsNavigationTarget(object view, INavigationContext navigation return path == viewType.Name || path == viewType.FullName; } - public static void OnNavigatedFrom(object view, INavigationContext navigationContext) + public static void OnNavigatedFrom(object view, NavigationContext navigationContext) { ViewAndViewModelAction(view, x => x.OnNavigatedFrom(navigationContext)); } - public static void OnNavigatedTo(object view, INavigationContext navigationContext) + public static void OnNavigatedTo(object view, NavigationContext navigationContext) { ViewAndViewModelAction(view, x => x.OnNavigatedTo(navigationContext)); } diff --git a/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj b/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj index 83159dbfbf..6fc5b9c8d3 100644 --- a/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj +++ b/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj @@ -13,16 +13,13 @@ Prism.Forms.Regions helps you more easily design and build rich, flexible, and e - - - - - + + True True diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/CarouselViewRegionAdapter.cs b/src/Forms/Prism.Forms.Regions/Regions/Adapters/CarouselViewRegionAdapter.cs index 0737ea9a3d..4ec0367111 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/CarouselViewRegionAdapter.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Adapters/CarouselViewRegionAdapter.cs @@ -56,7 +56,7 @@ protected override void Adapt(IRegion region, CarouselView regionTarget) region.ActiveViews.CollectionChanged += delegate { - var activeView = region.ActiveViews.FirstOrDefault(); + var activeView = region.ActiveViews.OfType().FirstOrDefault(); regionBehavior.CurrentView = activeView; regionTarget.CurrentItem = activeView; }; diff --git a/src/Forms/Prism.Forms.Regions/Regions/AllActiveRegion.cs b/src/Forms/Prism.Forms.Regions/Regions/AllActiveRegion.cs index 93baa9bf2c..eb56fc001f 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/AllActiveRegion.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/AllActiveRegion.cs @@ -1,6 +1,5 @@ using System; using Prism.Properties; -using Xamarin.Forms; namespace Prism.Regions { @@ -20,7 +19,7 @@ public class AllActiveRegion : Region /// /// The view to deactivate. /// Every time this method is called. - public override void Deactivate(VisualElement view) + public override void Deactivate(object view) { throw new InvalidOperationException(Resources.DeactiveNotPossibleException); } diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/AutoPopulateRegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/AutoPopulateRegionBehavior.cs index d6f17c1788..51c4496df3 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/AutoPopulateRegionBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/AutoPopulateRegionBehavior.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.ComponentModel; +using Prism.Ioc; using Xamarin.Forms; namespace Prism.Regions.Behaviors @@ -93,7 +94,7 @@ public virtual void OnViewRegistered(object sender, ViewRegisteredEventArgs e) if (e.RegionName == Region.Name) { - AddViewIntoRegion((VisualElement)e.GetView()); + AddViewIntoRegion((VisualElement)e.GetView(ContainerLocator.Container)); } } } diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/ClearChildViewsRegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/ClearChildViewsRegionBehavior.cs index fa014bb178..66528d71ce 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/ClearChildViewsRegionBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/ClearChildViewsRegionBehavior.cs @@ -1,4 +1,5 @@ using System; +using System.Linq; using Xamarin.Forms; namespace Prism.Regions.Behaviors @@ -60,7 +61,7 @@ protected override void OnAttach() private static void ClearChildViews(IRegion region) { - foreach (var view in region.Views) + foreach (var view in region.Views.OfType()) { if (GetClearChildViews(view)) { diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehavior.cs deleted file mode 100644 index 819937e1bf..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehavior.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System.Text; - -namespace Prism.Regions.Behaviors -{ - /// - /// Interface for allowing extensible behavior on regions. - /// - public interface IRegionBehavior - { - /// - /// The region that this behavior is extending. - /// - IRegion Region { get; set; } - - /// - /// Attaches the behavior to the specified region. - /// - void Attach(); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorCollection.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorCollection.cs deleted file mode 100644 index 3012f64fe6..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorCollection.cs +++ /dev/null @@ -1,33 +0,0 @@ -using System.Collections.Generic; - -namespace Prism.Regions.Behaviors -{ - /// - /// Defines the interface for a collection of classes on a Region. - /// - public interface IRegionBehaviorCollection : IEnumerable> - { - - /// - /// Adds a to the collection, using the specified key as an indexer. - /// - /// - /// The key that specifies the type of that's added. - /// - /// The to add. - void Add(string key, IRegionBehavior regionBehavior); - - /// - /// Checks if a with the specified key is already present. - /// - /// The key to use to find a particular . - /// - bool ContainsKey(string key); - - /// - /// Gets the with the specified key. - /// - /// The registered - IRegionBehavior this[string key] { get; } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorFactory.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorFactory.cs deleted file mode 100644 index 4e500cb92c..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IRegionBehaviorFactory.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Prism.Regions.Behaviors -{ - /// - /// Interface for RegionBehaviorFactories. This factory allows the registration of the default set of RegionBehaviors, that will - /// be added to the s of all s, unless overridden on a 'per-region' basis. - /// - public interface IRegionBehaviorFactory : IEnumerable - { - /// - /// Adds a particular type of RegionBehavior if it was not already registered. the string is used to check if the behavior is already present - /// - /// Type of the behavior to add. - /// The behavior key that's used to find if a certain behavior is already added. - void AddIfMissing(string behaviorKey) - where TBehavior : IRegionBehavior; - - /// - /// Determines whether a behavior with the specified key already exists - /// - /// The behavior key. - /// - /// if a behavior with the specified key is present; otherwise, . - /// - bool ContainsKey(string behaviorKey); - - /// - /// Creates an instance of the BehaviorType that's registered using the specified key. - /// - /// The key that's used to register a behavior type. - /// The created behavior. - IRegionBehavior CreateFromKey(string key); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionActiveAwareBehavior.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionActiveAwareBehavior.cs index 067b18072b..a1456d7014 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionActiveAwareBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionActiveAwareBehavior.cs @@ -90,7 +90,7 @@ private void InvokeOnSynchronizedActiveAwareChildren(object item, Action e.ActiveViews); + var activeViews = regionManager.Regions.SelectMany(e => e.ActiveViews).OfType(); var syncActiveViews = activeViews.Where(ShouldSyncActiveState); diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehavior.cs deleted file mode 100644 index 6284c4437e..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehavior.cs +++ /dev/null @@ -1,54 +0,0 @@ -using System; -using Prism.Properties; - -namespace Prism.Regions.Behaviors -{ - /// - /// Provides a base class for region's behaviors. - /// - public abstract class RegionBehavior : IRegionBehavior - { - private IRegion region; - - /// - /// Behavior's attached region. - /// - public IRegion Region - { - get => region; - set - { - if (IsAttached) - { - throw new InvalidOperationException(Resources.RegionBehaviorRegionCannotBeSetAfterAttach); - } - - region = value; - } - } - - /// - /// Returns if the behavior is attached to a region, otherwise. - /// - public bool IsAttached { get; private set; } - - /// - /// Attaches the behavior to the region. - /// - public void Attach() - { - if (region == null) - { - throw new InvalidOperationException(Resources.RegionBehaviorAttachCannotBeCallWithNullRegion); - } - - IsAttached = true; - OnAttach(); - } - - /// - /// Override this method to perform the logic after the behavior has been attached. - /// - protected abstract void OnAttach(); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorCollection.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorCollection.cs deleted file mode 100644 index c1f47c45ef..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorCollection.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; - -namespace Prism.Regions.Behaviors -{ - /// - /// A collection of instances, that are stored and retrieved by Key. - /// - public class RegionBehaviorCollection : IRegionBehaviorCollection - { - private readonly IRegion _region; - private readonly Dictionary _behaviors = new Dictionary(); - - /// - /// Initializes a new instance of the class and associates it with a region. - /// - /// The region to associate the behavior collection with. - public RegionBehaviorCollection(IRegion region) - { - _region = region; - } - - /// - /// Gets the with the specified key. - /// - /// The RegionBehavior that's registered with the key. - public IRegionBehavior this[string key] => _behaviors[key]; - - /// - /// Adds a to the collection, using the specified key as an indexer. - /// - /// The key that specifies the type of that's added. - /// The to add. - /// - /// Thrown is the parameter is Null, - /// or if the parameter is Null. - /// - /// Thrown if a behavior with the specified Key parameter already exists. - public void Add(string key, IRegionBehavior regionBehavior) - { - if (key == null) - throw new ArgumentNullException(nameof(key)); - - if (regionBehavior == null) - throw new ArgumentNullException(nameof(regionBehavior)); - - if (_behaviors.ContainsKey(key)) - throw new ArgumentException("Could not add duplicate behavior with same key.", nameof(key)); - - _behaviors.Add(key, regionBehavior); - regionBehavior.Region = _region; - - regionBehavior.Attach(); - } - - /// - /// Checks if a with the specified key is already present. - /// - /// The key to use to find a particular . - /// - public bool ContainsKey(string key) => _behaviors.ContainsKey(key); - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// A that can be used to iterate through the collection. - /// - public IEnumerator> GetEnumerator() => _behaviors.GetEnumerator(); - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - IEnumerator IEnumerable.GetEnumerator() => _behaviors.GetEnumerator(); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorFactory.cs b/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorFactory.cs deleted file mode 100644 index 85d584af3e..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionBehaviorFactory.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Globalization; -using Prism.Ioc; -using Prism.Properties; - -namespace Prism.Regions.Behaviors -{ - /// - /// Defines a factory that allows the registration of the default set of , that will - /// be added to the of all s, unless overridden on a 'per-region' basis. - /// - public class RegionBehaviorFactory : IRegionBehaviorFactory - { - private readonly IContainerProvider _container; - private readonly Dictionary _registeredBehaviors = new Dictionary(); - - /// - /// Initializes a new instance of . - /// - /// used to create the instance of the behavior from its . - public RegionBehaviorFactory(IContainerExtension container) - { - _container = container; - } - - /// - /// Adds a particular type of RegionBehavior if it was not already registered. The string is used to check if the behavior is already present - /// - /// Type of the behavior to add. - /// The behavior key that's used to find if a certain behavior is already added. - public void AddIfMissing(string behaviorKey) - where TBehavior : IRegionBehavior - { - if (behaviorKey == null) - { - throw new ArgumentNullException(nameof(behaviorKey)); - } - - var behaviorType = typeof(TBehavior); - - // Only add the behaviorKey if it doesn't already exists. - if (_registeredBehaviors.ContainsKey(behaviorKey)) - { - return; - } - - _registeredBehaviors.Add(behaviorKey, behaviorType); - } - - /// - /// Creates an instance of the behavior that is registered using the specified key. - /// - /// The key that is used to register a behavior type. - /// A new instance of the behavior. - public IRegionBehavior CreateFromKey(string key) - { - if (!ContainsKey(key)) - { - throw new ArgumentException( - string.Format(CultureInfo.CurrentUICulture, Resources.TypeWithKeyNotRegistered, key), nameof(key)); - } - - return (IRegionBehavior)_container.Resolve(_registeredBehaviors[key]); - } - - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// A that can be used to iterate through the collection. - /// - /// 1 - public IEnumerator GetEnumerator() => - _registeredBehaviors.Keys.GetEnumerator(); - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - /// 2 - IEnumerator IEnumerable.GetEnumerator() => - GetEnumerator(); - - /// - /// Determines whether a behavior with the specified key already exists. - /// - /// The behavior key. - /// - /// if a behavior with the specified key is present; otherwise, . - /// - public bool ContainsKey(string behaviorKey) => - _registeredBehaviors.ContainsKey(behaviorKey); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/INavigationServiceAware.cs b/src/Forms/Prism.Forms.Regions/Regions/INavigationServiceAware.cs index e7eab7a728..9086796f6d 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/INavigationServiceAware.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/INavigationServiceAware.cs @@ -1,7 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; -using Prism.Navigation; +using Prism.Navigation; namespace Prism.Regions { diff --git a/src/Forms/Prism.Forms.Regions/Regions/IRegion.cs b/src/Forms/Prism.Forms.Regions/Regions/IRegion.cs deleted file mode 100644 index c47f7305ad..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/IRegion.cs +++ /dev/null @@ -1,118 +0,0 @@ -using System; -using System.ComponentModel; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; -using Xamarin.Forms; - -namespace Prism.Regions -{ - /// - /// Defines a model that can be used to compose views. - /// - public interface IRegion : INotifyPropertyChanged - { - /// - /// Gets a readonly view of the collection of views in the region. - /// - /// An of all the added views. - IViewsCollection Views { get; } - - /// - /// Gets a readonly view of the collection of all the active views in the region. - /// - /// An of all the active views. - IViewsCollection ActiveViews { get; } - - /// - /// Gets or sets a context for the region. This value can be used by the user to share context with the views. - /// - /// The context value to be shared. - object Context { get; set; } - - /// - /// Gets the name of the region that uniquely identifies the region within a . - /// - /// The name of the region. - string Name { get; set; } - - /// - /// Gets or sets the comparison used to sort the views. - /// - /// The comparison to use. - Comparison SortComparison { get; set; } - - ///Adds a new view to the region. - /// - /// Adds a new view to the region. - /// - /// The view to add. - /// The that is set on the view if it is a . It will be the current region manager when using this overload. - IRegionManager Add(VisualElement view); - - /// - /// Adds a new view to the region. - /// - /// The view to add. - /// The name of the view. This can be used to retrieve it later by calling . - /// The that is set on the view if it is a . It will be the current region manager when using this overload. - IRegionManager Add(VisualElement view, string viewName); - - /// - /// Adds a new view to the region. - /// - /// The view to add. - /// The name of the view. This can be used to retrieve it later by calling . - /// When , the added view will receive a new instance of , otherwise it will use the current region manager for this region. - /// The that is set on the view if it is a . - IRegionManager Add(VisualElement view, string viewName, bool createRegionManagerScope); - - /// - /// Removes the specified view from the region. - /// - /// The view to remove. - void Remove(VisualElement view); - - /// - /// Removes all views from the region. - /// - void RemoveAll(); - - /// - /// Marks the specified view as active. - /// - /// The view to activate. - void Activate(VisualElement view); - - /// - /// Marks the specified view as inactive. - /// - /// The view to deactivate. - void Deactivate(VisualElement view); - - /// - /// Returns the view instance that was added to the region using a specific name. - /// - /// The name used when adding the view to the region. - /// Returns the named view or if the view with does not exist in the current region. - VisualElement GetView(string viewName); - - /// - /// Gets or sets the that will be passed to the views when adding them to the region, unless the view is added by specifying createRegionManagerScope as . - /// - /// The where this is registered. - /// This is usually used by implementations of and should not be - /// used by the developer explicitly. - IRegionManager RegionManager { get; set; } - - /// - /// Gets the collection of s that can extend the behavior of regions. - /// - IRegionBehaviorCollection Behaviors { get; } - - /// - /// Gets or sets the navigation service. - /// - /// The navigation service. - IRegionNavigationService NavigationService { get; set; } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/IRegionCollection.cs b/src/Forms/Prism.Forms.Regions/Regions/IRegionCollection.cs deleted file mode 100644 index 63afc9fca3..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/IRegionCollection.cs +++ /dev/null @@ -1,49 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Collections.Specialized; -using System.Linq; - -namespace Prism.Regions -{ - /// - /// Defines a collection of uniquely identified by their Name. - /// - public interface IRegionCollection : IEnumerable, INotifyCollectionChanged - { - /// - /// Gets the IRegion with the name received as index. - /// - /// Name of the region to be retrieved. - /// The identified with the requested name. - IRegion this[string regionName] { get; } - - /// - /// Adds a to the collection. - /// - /// Region to be added to the collection. - void Add(IRegion region); - - /// - /// Removes a from the collection. - /// - /// Name of the region to be removed. - /// if the region was removed from the collection, otherwise . - bool Remove(string regionName); - - /// - /// Checks if the collection contains a with the name received as parameter. - /// - /// The name of the region to look for. - /// if the region is contained in the collection, otherwise . - bool ContainsRegionWithName(string regionName); - - /// - /// Adds a region to the with the name received as argument. - /// - /// The name to be given to the region. - /// The region to be added to the . - /// Thrown if is . - /// Thrown if and 's name do not match and the is not . - void Add(string regionName, IRegion region); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/IRegionManager.cs b/src/Forms/Prism.Forms.Regions/Regions/IRegionManager.cs deleted file mode 100644 index b0677ec37a..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/IRegionManager.cs +++ /dev/null @@ -1,76 +0,0 @@ -using System; -using Prism.Navigation; -using Prism.Regions.Navigation; - -namespace Prism.Regions -{ - /// - /// Defines an interface to manage a set of regions and to attach regions to objects (typically controls). - /// - public interface IRegionManager - { - /// - /// Gets a collection of that identify each region by name. You can use this collection to add or remove regions to the current region manager. - /// - IRegionCollection Regions { get; } - - /// - /// Creates a new region manager. - /// - /// A new region manager that can be used as a different scope from the current region manager. - IRegionManager CreateRegionManager(); - - /// - /// Add a view to the Views collection of a Region. Note that the region must already exist in this . - /// - /// The name of the region to add a view to - /// The view to add to the views collection - /// The RegionManager, to easily add several views. - IRegionManager AddToRegion(string regionName, string targetName); - - /// - /// Associate a view with a region, by registering a type. When the region get's displayed - /// this type will be resolved using the ServiceLocator into a concrete instance. The instance - /// will be added to the Views collection of the region - /// - /// The name of the region to associate the view with. - /// The type of the view to register with the - /// The , for adding several views easily - IRegionManager RegisterViewWithRegion(string regionName, string targetName); - - /// - /// Associate a view with a region, by registering a type. When the region get's displayed - /// this type will be resolved using the ServiceLocator into a concrete instance. The instance - /// will be added to the Views collection of the region - /// - /// The name of the region to associate the view with. - /// The type of the view to register with the . - /// The , for adding several views easily - IRegionManager RegisterViewWithRegion(string regionName, Type viewType); - - /// - /// Initiates navigation to the target specified by the . - /// - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(string regionName, Uri target, Action navigationCallback); - - /// - /// Initiates navigation to the target specified by the . - /// - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// The navigation parameters specific to the navigation request. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(string regionName, Uri target, Action navigationCallback, INavigationParameters navigationParameters); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/IRegionManagerExtensions.cs b/src/Forms/Prism.Forms.Regions/Regions/IRegionManagerExtensions.cs deleted file mode 100644 index 6cd60626e6..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/IRegionManagerExtensions.cs +++ /dev/null @@ -1,123 +0,0 @@ -using System; -using Prism.Navigation; -using Prism.Regions.Navigation; - -namespace Prism.Regions -{ - /// - /// NavigationExtensions for the - /// - public static class IRegionManagerExtensions - { - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target) - { - RequestNavigate(regionManager, regionName, target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - regionManager.RequestNavigate(regionName, targetUri, navigationCallback); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri target) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - regionManager.RequestNavigate(regionName, target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback, INavigationParameters regionParameters) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - regionManager.RequestNavigate(regionName, targetUri, navigationCallback, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The RegionManager object. - /// The name of the Region to navigate to. - /// A Uri that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri target, INavigationParameters regionParameters) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - regionManager.RequestNavigate(regionName, target, nr => { }, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The RegionManager object. - /// The name of the Region to navigate to. - /// A string that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, INavigationParameters regionParameters) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - regionManager.RequestNavigate(regionName, new Uri(target, UriKind.RelativeOrAbsolute), nr => { }, regionParameters); - } - - /// - /// Associate a view with a region, by registering a type. When the region get's displayed - /// this type will be resolved using the ServiceLocator into a concrete instance. The instance - /// will be added to the Views collection of the region - /// - /// The type of the view to register with the . - /// The current . - /// The name of the region to associate the view with. - /// The , for adding several views easily - public static IRegionManager RegisterViewWithRegion(this IRegionManager regionManager, string regionName) => - regionManager.RegisterViewWithRegion(regionName, typeof(T)); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/IViewsCollection.cs b/src/Forms/Prism.Forms.Regions/Regions/IViewsCollection.cs deleted file mode 100644 index 5e571f8587..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/IViewsCollection.cs +++ /dev/null @@ -1,11 +0,0 @@ -using System.Collections.Generic; -using System.Collections.Specialized; -using Xamarin.Forms; - -namespace Prism.Regions -{ - public interface IViewsCollection : IEnumerable, INotifyCollectionChanged - { - bool Contains(VisualElement element); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IConfirmRegionNavigationRequest.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/IConfirmRegionNavigationRequest.cs deleted file mode 100644 index 73df7eeff1..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IConfirmRegionNavigationRequest.cs +++ /dev/null @@ -1,21 +0,0 @@ -using System; - -namespace Prism.Regions.Navigation -{ - /// - /// Provides a way for objects involved in navigation to determine if a navigation request should continue. - /// - public interface IConfirmRegionNavigationRequest : IRegionAware - { - /// - /// Determines whether this instance accepts being navigated away from. - /// - /// The navigation context. - /// The callback to indicate when navigation can proceed. - /// - /// Implementors of this method do not need to invoke the callback before this method is completed, - /// but they must ensure the callback is eventually invoked. - /// - void ConfirmNavigationRequest(INavigationContext navigationContext, Action continuationCallback); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IJournalAware.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/IJournalAware.cs deleted file mode 100644 index e787724088..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IJournalAware.cs +++ /dev/null @@ -1,14 +0,0 @@ -namespace Prism.Regions.Navigation -{ - /// - /// Provides a way for objects involved in navigation to opt-out of being added to the IRegionNavigationJournal backstack. - /// - public interface IJournalAware - { - /// - /// Determines if the current object is going to be added to the navigation journal's backstack. - /// - /// True, add to backstack. False, remove from backstack. - bool PersistInHistory(); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigateAsync.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigateAsync.cs deleted file mode 100644 index 0b1bc49759..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigateAsync.cs +++ /dev/null @@ -1,38 +0,0 @@ -using System; -using Prism.Navigation; - -namespace Prism.Regions.Navigation -{ - /// - /// Provides methods to perform navigation. - /// - /// - /// Convenience overloads for the methods in this interface can be found as extension methods on the - /// class. - /// - public interface INavigateAsync - { - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation target - /// The callback executed when the navigation request is completed. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(Uri target, Action navigationCallback); - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation target - /// The callback executed when the navigation request is completed. - /// The navigation parameters specific to the navigation request. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigationContext.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigationContext.cs deleted file mode 100644 index 91365e1a02..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/INavigationContext.cs +++ /dev/null @@ -1,44 +0,0 @@ -using System; -using Prism.Ioc.Internals; -using Prism.Navigation; - -namespace Prism.Regions.Navigation -{ - /// - /// Encapsulates information about a navigation request. - /// - public interface INavigationContext - { - /// - /// Gets the region navigation service. - /// - /// The navigation service. - IRegionNavigationService NavigationService { get; } - - /// - /// Gets the extracted from the URI and the object parameters passed in navigation. - /// - /// The URI query. - INavigationParameters Parameters { get; } - - /// - /// Gets the navigation URI. - /// - /// The navigation URI. - Uri Uri { get; } - } - - public static class INavigationContextExtensions - { - public static string NavigatedName(this INavigationContext context) - { - var uri = context.Uri; - if (!uri.IsAbsoluteUri) - { - uri = new Uri(new Uri("nav://local.app"), context.Uri); - } - - return uri.LocalPath.StartsWith("/") ? uri.LocalPath.Substring(1) : uri.LocalPath; - } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationContentLoader.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationContentLoader.cs deleted file mode 100644 index b1f7b01051..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationContentLoader.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; - -namespace Prism.Regions.Navigation -{ - /// - /// Identifies the view in a region that is the target of a navigation request. - /// - public interface IRegionNavigationContentLoader - { - /// - /// Gets the content to which the navigation request represented by applies. - /// - /// - /// If none of the items in the region match the target of the navigation request, a new item - /// will be created and added to the region. - /// - /// The region. - /// The context representing the navigation request. - /// The item to be the target of the navigation request. - /// when a new item cannot be created for the navigation request. - object LoadContent(IRegion region, INavigationContext navigationContext); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationJournalEntry.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationJournalEntry.cs deleted file mode 100644 index a03d66f2b5..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationJournalEntry.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using Prism.Navigation; - -namespace Prism.Regions.Navigation -{ - /// - /// An entry in an IRegionNavigationJournal representing the URI navigated to. - /// - public interface IRegionNavigationJournalEntry - { - /// - /// Gets or sets the URI. - /// - /// The URI. - Uri Uri { get; set; } - - /// - /// Gets or sets the NavigationParameters instance. - /// - INavigationParameters Parameters { get; set; } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationResult.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationResult.cs deleted file mode 100644 index 64521c2994..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationResult.cs +++ /dev/null @@ -1,28 +0,0 @@ -using System; - -namespace Prism.Regions.Navigation -{ - /// - /// Represents the result of navigating to a URI. - /// - public interface IRegionNavigationResult - { - /// - /// Gets the navigation context. - /// - /// The navigation context. - INavigationContext Context { get; } - - /// - /// Gets an exception that occurred while navigating. - /// - /// The exception. - Exception Error { get; } - - /// - /// Gets the result. - /// - /// The result. - bool? Result { get; } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationService.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationService.cs deleted file mode 100644 index 885c1a6a08..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationService.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; - -namespace Prism.Regions.Navigation -{ - /// - /// Provides navigation for regions. - /// - public interface IRegionNavigationService : INavigateAsync - { - /// - /// Gets or sets the region owning this service. - /// - /// A Region. - IRegion Region { get; set; } - - /// - /// Gets the journal. - /// - /// The journal. - IRegionNavigationJournal Journal { get; } - - /// - /// Raised when the region is about to be navigated to content. - /// - event EventHandler Navigating; - - /// - /// Raised when the region is navigated to content. - /// - event EventHandler Navigated; - - /// - /// Raised when a navigation request fails. - /// - event EventHandler NavigationFailed; - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationAsyncExtensions.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationAsyncExtensions.cs deleted file mode 100644 index db20e11626..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationAsyncExtensions.cs +++ /dev/null @@ -1,104 +0,0 @@ -using System; -using Prism.Navigation; - -namespace Prism.Regions.Navigation -{ - /// - /// Provides additional methods to the interface. - /// - public static class NavigationAsyncExtensions - { - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - public static void RequestNavigate(this INavigateAsync navigation, string target) - { - RequestNavigate(navigation, target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - /// The callback executed when the navigation request is completed. - public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - navigation.RequestNavigate(targetUri, navigationCallback); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - public static void RequestNavigate(this INavigateAsync navigation, Uri target) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - navigation.RequestNavigate(target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback, INavigationParameters regionParameters) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - navigation.RequestNavigate(targetUri, navigationCallback, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// A Uri that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this INavigateAsync navigation, Uri target, INavigationParameters regionParameters) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - navigation.RequestNavigate(target, nr => { }, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// A string that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this INavigateAsync navigation, string target, INavigationParameters regionParameters) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - navigation.RequestNavigate(new Uri(target, UriKind.RelativeOrAbsolute), nr => { }, regionParameters); - } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationContext.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationContext.cs deleted file mode 100644 index a813f6e3fd..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/NavigationContext.cs +++ /dev/null @@ -1,70 +0,0 @@ -using System; -using System.Collections.Generic; -using Prism.Common; -using Prism.Navigation; - -namespace Prism.Regions.Navigation -{ - /// - /// Encapsulates information about a navigation request. - /// - public class NavigationContext : INavigationContext - { - /// - /// Initializes a new instance of the class for a region name and a - /// . - /// - /// The navigation service. - /// The Uri. - public NavigationContext(IRegionNavigationService navigationService, Uri uri) - : this(navigationService, uri, null) - { - } - - /// - /// Initializes a new instance of the class for a region name and a - /// . - /// - /// The navigation service. - /// The navigation parameters. - /// The Uri. - public NavigationContext(IRegionNavigationService navigationService, Uri uri, INavigationParameters regionParameters) - { - NavigationService = navigationService; - Uri = uri; - Parameters = regionParameters ?? new NavigationParameters(); - - var queryString = uri != null ? UriParsingHelper.EnsureAbsolute(uri).Query : null; - if (!string.IsNullOrEmpty(queryString)) - { - UpdateRegionParameters(new NavigationParameters(queryString)); - } - } - - /// - /// Gets the region navigation service. - /// - /// The navigation service. - public IRegionNavigationService NavigationService { get; private set; } - - /// - /// Gets the navigation URI. - /// - /// The navigation URI. - public Uri Uri { get; } - - /// - /// Gets the extracted from the URI and the object parameters passed in navigation. - /// - /// The URI query. - public INavigationParameters Parameters { get; } - - private void UpdateRegionParameters(INavigationParameters regionParameters) - { - foreach (KeyValuePair parameter in regionParameters) - { - Parameters.Add(parameter.Key, parameter.Value); - } - } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationContentLoader.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationContentLoader.cs index 44ed0af565..83d727427f 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationContentLoader.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationContentLoader.cs @@ -5,7 +5,6 @@ using Prism.Common; using Prism.Ioc; using Prism.Ioc.Internals; -using Prism.Mvvm; using Prism.Properties; using Xamarin.Forms; @@ -41,7 +40,7 @@ public RegionNavigationContentLoader(IContainerExtension container) /// is created and added to the region. /// /// when a new view cannot be created for the navigation request. - public object LoadContent(IRegion region, INavigationContext navigationContext) + public object LoadContent(IRegion region, NavigationContext navigationContext) { if (region == null) throw new ArgumentNullException(nameof(region)); @@ -105,7 +104,7 @@ protected virtual object CreateNewRegionItem(string candidateTargetContract) /// /// The navigation contract. /// The candidate contract to seek within the and to use, if not found, when resolving from the container. - protected virtual string GetContractFromNavigationContext(INavigationContext navigationContext) + protected virtual string GetContractFromNavigationContext(NavigationContext navigationContext) { if (navigationContext == null) throw new ArgumentNullException(nameof(navigationContext)); @@ -150,7 +149,8 @@ protected virtual IEnumerable GetCandidatesFromRegion(IRegion reg private IEnumerable GetCandidatesFromRegionViews(IRegion region, string candidateNavigationContract) { - return region.Views.Where(v => ViewIsMatch(v.GetType(), candidateNavigationContract)); + return region.Views.OfType() + .Where(v => ViewIsMatch(v.GetType(), candidateNavigationContract)); } private static bool ViewIsMatch(Type viewType, string navigationSegment) diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournal.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournal.cs deleted file mode 100644 index 2919d3959d..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournal.cs +++ /dev/null @@ -1,147 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace Prism.Regions.Navigation -{ - /// - /// Provides journaling of current, back, and forward navigation within regions. - /// - public class RegionNavigationJournal : IRegionNavigationJournal - { - private readonly Stack _backStack = new Stack(); - private readonly Stack _forwardStack = new Stack(); - - private bool _isNavigatingInternal; - - /// - /// Gets or sets the target that implements INavigate. - /// - /// The INavigate implementation. - /// - /// This is set by the owner of this journal. - /// - public INavigateAsync NavigationTarget { get; set; } - - /// - /// Gets the current navigation entry of the content that is currently displayed. - /// - /// The current entry. - public IRegionNavigationJournalEntry CurrentEntry { get; private set; } - - /// - /// Gets a value that indicates whether there is at least one entry in the back navigation history. - /// - /// true if the journal can go back; otherwise, false. - public bool CanGoBack => _backStack.Count > 0; - - /// - /// Gets a value that indicates whether there is at least one entry in the forward navigation history. - /// - /// - /// true if this instance can go forward; otherwise, false. - /// - public bool CanGoForward => _forwardStack.Count > 0; - - /// - /// Navigates to the most recent entry in the back navigation history, or does nothing if no entry exists in back navigation. - /// - public void GoBack() - { - if (CanGoBack) - { - IRegionNavigationJournalEntry entry = _backStack.Peek(); - InternalNavigate( - entry, - result => - { - if (result) - { - if (CurrentEntry != null) - { - _forwardStack.Push(CurrentEntry); - } - - _backStack.Pop(); - CurrentEntry = entry; - } - }); - } - } - - /// - /// Navigates to the most recent entry in the forward navigation history, or does nothing if no entry exists in forward navigation. - /// - public void GoForward() - { - if (CanGoForward) - { - IRegionNavigationJournalEntry entry = _forwardStack.Peek(); - InternalNavigate( - entry, - result => - { - if (result) - { - if (CurrentEntry != null) - { - _backStack.Push(CurrentEntry); - } - - _forwardStack.Pop(); - CurrentEntry = entry; - } - }); - } - } - - /// - /// Records the navigation to the entry.. - /// - /// The entry to record. - /// Determine if the view is added to the back stack or excluded from the history. - public void RecordNavigation(IRegionNavigationJournalEntry entry, bool persistInHistory) - { - if (!_isNavigatingInternal) - { - if (CurrentEntry != null) - { - _backStack.Push(CurrentEntry); - } - - _forwardStack.Clear(); - - if (persistInHistory) - CurrentEntry = entry; - else - CurrentEntry = null; - } - } - - /// - /// Clears the journal of current, back, and forward navigation histories. - /// - public void Clear() - { - CurrentEntry = null; - _backStack.Clear(); - _forwardStack.Clear(); - } - - private void InternalNavigate(IRegionNavigationJournalEntry entry, Action callback) - { - _isNavigatingInternal = true; - NavigationTarget.RequestNavigate( - entry.Uri, - nr => - { - _isNavigatingInternal = false; - - if (nr.Result.HasValue) - { - callback(nr.Result.Value); - } - }, - entry.Parameters); - } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournalEntry.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournalEntry.cs deleted file mode 100644 index b87bb74f24..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationJournalEntry.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Globalization; -using Prism.Navigation; - -namespace Prism.Regions.Navigation -{ - /// - /// An entry in an IRegionNavigationJournal representing the URI navigated to. - /// - public class RegionNavigationJournalEntry : IRegionNavigationJournalEntry - { - /// - /// Gets or sets the URI. - /// - /// The URI. - public Uri Uri { get; set; } - - /// - /// Gets or sets the NavigationParameters instance. - /// - public INavigationParameters Parameters { get; set; } - - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - if (Uri != null) - { - return string.Format(CultureInfo.CurrentCulture, "RegionNavigationJournalEntry:'{0}'", Uri.ToString()); - } - - return base.ToString(); - } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationResult.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationResult.cs deleted file mode 100644 index ffb5c88f7f..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationResult.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; - -namespace Prism.Regions.Navigation -{ - /// - /// Represents the result of navigating to a URI. - /// - public class RegionNavigationResult : IRegionNavigationResult - { - /// - /// Initializes a new instance of the class. - /// - /// The context. - /// The result. - public RegionNavigationResult(INavigationContext context, bool? result) - { - Context = context; - Result = result; - } - - /// - /// Initializes a new instance of the class. - /// - /// The context. - /// The error. - public RegionNavigationResult(INavigationContext context, Exception error) - { - Context = context; - Error = error; - Result = false; - } - - /// - /// Gets the result. - /// - /// The result. - public bool? Result { get; } - - /// - /// Gets an exception that occurred while navigating. - /// - /// The exception. - public Exception Error { get; } - - /// - /// Gets the navigation context. - /// - /// The navigation context. - public INavigationContext Context { get; } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationService.cs b/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationService.cs index 5bcb5b9982..80f1791f53 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationService.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationService.cs @@ -1,10 +1,10 @@ using System; -using System.Collections.Generic; using System.Linq; using Prism.Common; using Prism.Ioc; using Prism.Navigation; using Prism.Properties; +using Prism.Regions; using Xamarin.Forms; namespace Prism.Regions.Navigation @@ -49,7 +49,7 @@ public RegionNavigationService(IContainerExtension container, IRegionNavigationC /// public event EventHandler Navigating; - private void RaiseNavigating(INavigationContext navigationContext) + private void RaiseNavigating(NavigationContext navigationContext) { Navigating?.Invoke(this, new RegionNavigationEventArgs(navigationContext)); } @@ -59,7 +59,7 @@ private void RaiseNavigating(INavigationContext navigationContext) /// public event EventHandler Navigated; - private void RaiseNavigated(INavigationContext navigationContext) + private void RaiseNavigated(NavigationContext navigationContext) { Navigated?.Invoke(this, new RegionNavigationEventArgs(navigationContext)); } @@ -69,28 +69,18 @@ private void RaiseNavigated(INavigationContext navigationContext) /// public event EventHandler NavigationFailed; - private void RaiseNavigationFailed(INavigationContext navigationContext, Exception error) + private void RaiseNavigationFailed(NavigationContext navigationContext, Exception error) { NavigationFailed?.Invoke(this, new RegionNavigationFailedEventArgs(navigationContext, error)); } - /// - /// Initiates navigation to the specified target. - /// - /// The target. - /// A callback to execute when the navigation request is completed. - public void RequestNavigate(Uri target, Action navigationCallback) - { - RequestNavigate(target, navigationCallback, null); - } - /// /// Initiates navigation to the specified target. /// /// The target. /// A callback to execute when the navigation request is completed. /// The navigation parameters specific to the navigation request. - public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters regionParameters) + public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters regionParameters) { if (navigationCallback == null) throw new ArgumentNullException(nameof(navigationCallback)); @@ -105,7 +95,7 @@ public void RequestNavigate(Uri target, Action navigati } } - private void DoNavigate(Uri source, Action navigationCallback, INavigationParameters regionParameters) + private void DoNavigate(Uri source, Action navigationCallback, INavigationParameters regionParameters) { if (source == null) throw new ArgumentNullException(nameof(source)); @@ -119,19 +109,19 @@ private void DoNavigate(Uri source, Action navigationCa RequestCanNavigateFromOnCurrentlyActiveView( _currentNavigationContext, navigationCallback, - Region.ActiveViews.ToArray(), + Region.ActiveViews.OfType().ToArray(), 0); } private void RequestCanNavigateFromOnCurrentlyActiveView( - INavigationContext navigationContext, - Action navigationCallback, + NavigationContext navigationContext, + Action navigationCallback, VisualElement[] activeViews, int currentViewIndex) { if (currentViewIndex < activeViews.Length) { - if (activeViews[currentViewIndex] is IConfirmRegionNavigationRequest vetoingView) + if (activeViews[currentViewIndex] is IConfirmNavigationRequest vetoingView) { // the current active view implements IConfirmNavigationRequest, request confirmation // providing a callback to resume the navigation request @@ -169,12 +159,12 @@ private void RequestCanNavigateFromOnCurrentlyActiveView( } private void RequestCanNavigateFromOnCurrentlyActiveViewModel( - INavigationContext navigationContext, - Action navigationCallback, + NavigationContext navigationContext, + Action navigationCallback, VisualElement[] activeViews, int currentViewIndex) { - if (activeViews[currentViewIndex].BindingContext is IConfirmRegionNavigationRequest vetoingViewModel) + if (activeViews[currentViewIndex].BindingContext is IConfirmNavigationRequest vetoingViewModel) { // the data model for the current active view implements IConfirmNavigationRequest, request confirmation // providing a callback to resume the navigation request @@ -206,7 +196,7 @@ private void RequestCanNavigateFromOnCurrentlyActiveViewModel( currentViewIndex + 1); } - private void ExecuteNavigation(INavigationContext navigationContext, object[] activeViews, Action navigationCallback) + private void ExecuteNavigation(NavigationContext navigationContext, object[] activeViews, Action navigationCallback) { try { @@ -231,7 +221,7 @@ private void ExecuteNavigation(INavigationContext navigationContext, object[] ac // The view can be informed of navigation MvvmHelpers.OnNavigatedTo(view, navigationContext); - navigationCallback(new RegionNavigationResult(navigationContext, true)); + navigationCallback(new NavigationResult(navigationContext, true)); // Raise the navigated event when navigation is completed. RaiseNavigated(navigationContext); @@ -249,16 +239,16 @@ private static bool PersistInHistory(object view) return persist; } - private void NotifyNavigationFailed(INavigationContext navigationContext, Action navigationCallback, Exception e) + private void NotifyNavigationFailed(NavigationContext navigationContext, Action navigationCallback, Exception e) { var navigationResult = - e != null ? new RegionNavigationResult(navigationContext, e) : new RegionNavigationResult(navigationContext, false); + e != null ? new NavigationResult(navigationContext, e) : new NavigationResult(navigationContext, false); navigationCallback(navigationResult); RaiseNavigationFailed(navigationContext, e); } - private static void NotifyActiveViewsNavigatingFrom(INavigationContext navigationContext, object[] activeViews) + private static void NotifyActiveViewsNavigatingFrom(NavigationContext navigationContext, object[] activeViews) { foreach (var item in activeViews) { diff --git a/src/Forms/Prism.Forms.Regions/Regions/Region.cs b/src/Forms/Prism.Forms.Regions/Regions/Region.cs index 72b8bc2490..79fec8b92d 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Region.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Region.cs @@ -6,8 +6,6 @@ using Prism.Mvvm; using Prism.Navigation; using Prism.Properties; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; using Xamarin.Forms; namespace Prism.Regions @@ -21,7 +19,7 @@ public class Region : BindableBase, IRegion, INavigationServiceAware private IRegionManager _regionManager; private IRegionNavigationService _regionNavigationService; - private Comparison _sort; + private Comparison _sort; /// /// Initializes a new instance of . @@ -130,7 +128,7 @@ public string Name /// Gets or sets the comparison used to sort the views. /// /// The comparison to use. - public Comparison SortComparison + public Comparison SortComparison { get => _sort; set @@ -207,7 +205,7 @@ protected virtual ObservableCollection ItemMetadataCollection /// Marks the specified view as active. /// /// The view to activate. - public virtual void Activate(VisualElement view) + public virtual void Activate(object view) { var itemMetadata = GetItemMetadataOrThrow(view); @@ -221,7 +219,7 @@ public virtual void Activate(VisualElement view) /// Marks the specified view as inactive. /// /// The view to deactivate. - public virtual void Deactivate(VisualElement view) + public virtual void Deactivate(object view) { var itemMetadata = GetItemMetadataOrThrow(view); @@ -237,7 +235,7 @@ public virtual void Deactivate(VisualElement view) /// /// The view to add. /// The that is set on the view if it is a . It will be the current region manager when using this overload. - public IRegionManager Add(VisualElement view) + public IRegionManager Add(object view) { return Add(view, null, false); } @@ -248,7 +246,7 @@ public IRegionManager Add(VisualElement view) /// The view to add. /// The name of the view. This can be used to retrieve it later by calling . /// The that is set on the view if it is a . It will be the current region manager when using this overload. - public IRegionManager Add(VisualElement view, string viewName) + public IRegionManager Add(object view, string viewName) { if (string.IsNullOrEmpty(viewName)) { @@ -265,21 +263,26 @@ public IRegionManager Add(VisualElement view, string viewName) /// The name of the view. This can be used to retrieve it later by calling . /// When , the added view will receive a new instance of , otherwise it will use the current region manager for this region. /// The that is set on the view if it is a . - public virtual IRegionManager Add(VisualElement view, string viewName, bool createRegionManagerScope) + public virtual IRegionManager Add(object view, string viewName, bool createRegionManagerScope) { IRegionManager manager = createRegionManagerScope ? RegionManager.CreateRegionManager() : RegionManager; InnerAdd(view, viewName, manager); return manager; } - private void InnerAdd(VisualElement view, string viewName, IRegionManager scopedRegionManager) + private void InnerAdd(object view, string viewName, IRegionManager scopedRegionManager) { if (ItemMetadataCollection.FirstOrDefault(x => x.Item == view) != null) { throw new InvalidOperationException(Resources.RegionViewExistsException); } - var itemMetadata = new ItemMetadata(view); + if (view is not VisualElement visualElement) + { + throw new Exception("View is not a Visual Element"); + } + + var itemMetadata = new ItemMetadata(visualElement); if (!string.IsNullOrEmpty(viewName)) { if (ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName) != null) @@ -289,7 +292,7 @@ private void InnerAdd(VisualElement view, string viewName, IRegionManager scoped itemMetadata.Name = viewName; } - Xaml.RegionManager.SetRegionManager(view, scopedRegionManager); + Xaml.RegionManager.SetRegionManager(visualElement, scopedRegionManager); ItemMetadataCollection.Add(itemMetadata); } @@ -320,15 +323,20 @@ public virtual VisualElement GetView(string viewName) /// Removes the specified view from the region. /// /// The view to remove. - public void Remove(VisualElement view) + public void Remove(object view) { + if (view is not VisualElement visualElement) + { + throw new Exception("View is not a Visual Element"); + } + var itemMetadata = GetItemMetadataOrThrow(view); ItemMetadataCollection.Remove(itemMetadata); - if (Xaml.RegionManager.GetRegionManager(view) == RegionManager) + if (Xaml.RegionManager.GetRegionManager(visualElement) == RegionManager) { - view.ClearValue(Xaml.RegionManager.RegionManagerProperty); + visualElement.ClearValue(Xaml.RegionManager.RegionManagerProperty); } } @@ -413,5 +421,15 @@ private static int ViewSortHintAttributeComparison(ViewSortHintAttribute x, View } } } + + object IRegion.GetView(string viewName) + { + throw new NotImplementedException(); + } + + public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) + { + throw new NotImplementedException(); + } } } diff --git a/src/Forms/Prism.Forms.Regions/Regions/RegionManager.cs b/src/Forms/Prism.Forms.Regions/Regions/RegionManager.cs index 35aab5b36b..1cd77e8455 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/RegionManager.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/RegionManager.cs @@ -6,7 +6,6 @@ using Prism.Ioc.Internals; using Prism.Navigation; using Prism.Properties; -using Prism.Regions.Navigation; using Xamarin.Forms; namespace Prism.Regions @@ -49,6 +48,20 @@ public IRegionManager AddToRegion(string regionName, string targetName) return Regions[regionName].Add(view); } + /// + /// Add a view to the Views collection of a Region. Note that the region must already exist in this . + /// + /// The name of the region to add a view to + /// The view to add to the views collection + /// The RegionManager, to easily add several views. + public IRegionManager AddToRegion(string regionName, object view) + { + if (!Regions.ContainsRegionWithName(regionName)) + throw new ArgumentException(string.Format(Thread.CurrentThread.CurrentCulture, Resources.RegionNotFound, regionName), nameof(regionName)); + + return Regions[regionName].Add(view); + } + /// /// Creates a new region manager. /// @@ -89,13 +102,21 @@ public IRegionManager RegisterViewWithRegion(string regionName, string targetNam } /// - /// Navigates the specified region manager. + /// Associate a view with a region, using a delegate to resolve a concrete instance of the view. + /// When the region get's displayed, this delegate will be called and the result will be added to the + /// views collection of the region. /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - /// The navigation callback. - public void RequestNavigate(string regionName, Uri target, Action navigationCallback) => - RequestNavigate(regionName, target, navigationCallback, null); + /// The name of the region to associate the view with. + /// The delegate used to resolve a concrete instance of the view. + /// The , for adding several views easily + public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) + { + var regionViewRegistry = ContainerLocator.Container.Resolve(); + + regionViewRegistry.RegisterViewWithRegion(regionName, getContentDelegate); + + return this; + } /// /// This method allows an to locate a specified region and navigate in it to the specified target , passing a navigation callback and an instance of , which holds a collection of object parameters. @@ -104,7 +125,7 @@ public void RequestNavigate(string regionName, Uri target, ActionA that represents the target where the region will navigate. /// The navigation callback that will be executed after the navigation is completed. /// An instance of , which holds a collection of object parameters. - public void RequestNavigate(string regionName, Uri target, Action navigationCallback, INavigationParameters navigationParameters) + public void RequestNavigate(string regionName, Uri target, Action navigationCallback, INavigationParameters navigationParameters) { try { @@ -121,7 +142,7 @@ public void RequestNavigate(string regionName, Uri target, ActionThe view to activate. /// If there is an active view before calling this method, /// that view will be deactivated automatically. - public override void Activate(VisualElement view) + public override void Activate(object view) { var currentActiveView = ActiveViews.FirstOrDefault(); diff --git a/src/Forms/Prism.Forms.Regions/Regions/ViewRegisteredEventArgs.cs b/src/Forms/Prism.Forms.Regions/Regions/ViewRegisteredEventArgs.cs deleted file mode 100644 index 9825db318e..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/ViewRegisteredEventArgs.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; - -namespace Prism.Regions -{ - /// - /// Argument class used by the event when a new content is registered. - /// - public class ViewRegisteredEventArgs : EventArgs - { - /// - /// Initializes the ViewRegisteredEventArgs class. - /// - /// The region name to which the content was registered. - /// The content which was registered. - public ViewRegisteredEventArgs(string regionName, Func getViewDelegate) - { - GetView = getViewDelegate; - RegionName = regionName; - } - - /// - /// Gets the region name to which the content was registered. - /// - public string RegionName { get; private set; } - - /// - /// Gets the content which was registered. - /// - public Func GetView { get; private set; } - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/ViewsCollection.cs b/src/Forms/Prism.Forms.Regions/Regions/ViewsCollection.cs index d707457b92..53ae7315e3 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/ViewsCollection.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/ViewsCollection.cs @@ -65,7 +65,7 @@ public Comparison SortComparison /// /// The object to locate in the collection. /// if is found in the collection; otherwise, . - public bool Contains(VisualElement value) => filteredItems.Contains(value); + public bool Contains(object value) => filteredItems.Contains(value); /// ///Returns an enumerator that iterates through the collection. @@ -73,7 +73,7 @@ public Comparison SortComparison /// ///A that can be used to iterate through the collection. /// - public IEnumerator GetEnumerator() => filteredItems.GetEnumerator(); + public IEnumerator GetEnumerator() => filteredItems.GetEnumerator(); /// ///Returns an enumerator that iterates through a collection. diff --git a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs index 279e5d47eb..52c26bdf0a 100644 --- a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs +++ b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs @@ -2,6 +2,7 @@ using System.Reflection; using Prism.Navigation; using Prism.Navigation.Xaml; +using Prism.Regions; using Prism.Regions.Navigation; using NavigationMode = Prism.Navigation.NavigationMode; using TabbedPage = Microsoft.Maui.Controls.TabbedPage; @@ -120,7 +121,7 @@ public static T GetImplementerFromViewOrViewModel(object view) return null; } - public static bool IsNavigationTarget(object view, INavigationContext navigationContext) + public static bool IsNavigationTarget(object view, NavigationContext navigationContext) { var implementor = GetImplementerFromViewOrViewModel(view); if (implementor is not null) @@ -135,12 +136,12 @@ public static bool IsNavigationTarget(object view, INavigationContext navigation return path == viewType.Name || path == viewType.FullName; } - public static void OnNavigatedFrom(object view, INavigationContext navigationContext) + public static void OnNavigatedFrom(object view, NavigationContext navigationContext) { InvokeViewAndViewModelAction(view, x => x.OnNavigatedFrom(navigationContext)); } - public static void OnNavigatedTo(object view, INavigationContext navigationContext) + public static void OnNavigatedTo(object view, NavigationContext navigationContext) { InvokeViewAndViewModelAction(view, x => x.OnNavigatedTo(navigationContext)); } diff --git a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs index 086cb6c664..5ea94814b0 100644 --- a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs +++ b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs @@ -7,6 +7,9 @@ namespace Prism.Ioc; +/// +/// Provides common extensions for Service Registrations for Prism.Maui +/// public static class RegionNavigationRegistrationExtensions { /// diff --git a/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs b/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs index c3e2da6132..e9105c42ac 100644 --- a/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs +++ b/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs @@ -16,6 +16,7 @@ public void Add(IRegion region) public IEnumerator GetEnumerator() => _regions.SelectMany(x => x.ActiveViews) + .OfType() .Where(x => x is not null) // sanity check .GetEnumerator(); diff --git a/src/Maui/Prism.Maui/PrismAppBuilder.cs b/src/Maui/Prism.Maui/PrismAppBuilder.cs index 357f46300a..15e92de34c 100644 --- a/src/Maui/Prism.Maui/PrismAppBuilder.cs +++ b/src/Maui/Prism.Maui/PrismAppBuilder.cs @@ -1,19 +1,19 @@ +using Microsoft.Maui.LifecycleEvents; using Prism.AppModel; using Prism.Behaviors; using Prism.Common; using Prism.Controls; +using Prism.Dialogs; using Prism.Events; using Prism.Ioc; using Prism.Modularity; using Prism.Mvvm; using Prism.Navigation; using Prism.Navigation.Xaml; +using Prism.Regions; using Prism.Regions.Adapters; -using Prism.Regions.Behaviors; using Prism.Services; -using Microsoft.Maui.LifecycleEvents; using TabbedPage = Microsoft.Maui.Controls.TabbedPage; -using Prism.Dialogs; namespace Prism; diff --git a/src/Maui/Prism.Maui/Regions/Adapters/CarouselViewRegionAdapter.cs b/src/Maui/Prism.Maui/Regions/Adapters/CarouselViewRegionAdapter.cs index 4eea8ecfef..de3f208228 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/CarouselViewRegionAdapter.cs +++ b/src/Maui/Prism.Maui/Regions/Adapters/CarouselViewRegionAdapter.cs @@ -47,7 +47,7 @@ protected override void Adapt(IRegion region, CarouselView regionTarget) region.ActiveViews.CollectionChanged += delegate { - var activeView = region.ActiveViews.FirstOrDefault(); + var activeView = region.ActiveViews.OfType().FirstOrDefault(); regionBehavior.CurrentView = activeView; regionTarget.CurrentItem = activeView; }; diff --git a/src/Maui/Prism.Maui/Regions/AllActiveRegion.cs b/src/Maui/Prism.Maui/Regions/AllActiveRegion.cs index e93b79180e..f7dc459d20 100644 --- a/src/Maui/Prism.Maui/Regions/AllActiveRegion.cs +++ b/src/Maui/Prism.Maui/Regions/AllActiveRegion.cs @@ -1,5 +1,4 @@ using Prism.Properties; -using Prism.Regions.Navigation; namespace Prism.Regions; @@ -8,6 +7,10 @@ namespace Prism.Regions; /// public class AllActiveRegion : Region { + /// + /// Creates a new . + /// + /// public AllActiveRegion(IRegionNavigationService regionNavigationService) : base(regionNavigationService) { @@ -24,7 +27,7 @@ public AllActiveRegion(IRegionNavigationService regionNavigationService) /// /// The view to deactivate. /// Every time this method is called. - public override void Deactivate(VisualElement view) + public override void Deactivate(object view) { throw new InvalidOperationException(Resources.DeactiveNotPossibleException); } diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/ClearChildViewsRegionBehavior.cs b/src/Maui/Prism.Maui/Regions/Behaviors/ClearChildViewsRegionBehavior.cs index b8077465ad..c47c77846a 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/ClearChildViewsRegionBehavior.cs +++ b/src/Maui/Prism.Maui/Regions/Behaviors/ClearChildViewsRegionBehavior.cs @@ -57,7 +57,7 @@ protected override void OnAttach() private static void ClearChildViews(IRegion region) { - foreach (var view in region.Views) + foreach (var view in region.Views.OfType()) { if (GetClearChildViews(view)) { diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehavior.cs b/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehavior.cs deleted file mode 100644 index e29d1e83a4..0000000000 --- a/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehavior.cs +++ /dev/null @@ -1,17 +0,0 @@ -namespace Prism.Regions.Behaviors; - -/// -/// Interface for allowing extensible behavior on regions. -/// -public interface IRegionBehavior -{ - /// - /// The region that this behavior is extending. - /// - IRegion Region { get; set; } - - /// - /// Attaches the behavior to the specified region. - /// - void Attach(); -} diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorCollection.cs b/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorCollection.cs deleted file mode 100644 index f95df48ff2..0000000000 --- a/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorCollection.cs +++ /dev/null @@ -1,30 +0,0 @@ -namespace Prism.Regions.Behaviors; - -/// -/// Defines the interface for a collection of classes on a Region. -/// -public interface IRegionBehaviorCollection : IEnumerable> -{ - - /// - /// Adds a to the collection, using the specified key as an indexer. - /// - /// - /// The key that specifies the type of that's added. - /// - /// The to add. - void Add(string key, IRegionBehavior regionBehavior); - - /// - /// Checks if a with the specified key is already present. - /// - /// The key to use to find a particular . - /// - bool ContainsKey(string key); - - /// - /// Gets the with the specified key. - /// - /// The registered - IRegionBehavior this[string key] { get; } -} diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorFactory.cs b/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorFactory.cs deleted file mode 100644 index 6bd82f25b2..0000000000 --- a/src/Maui/Prism.Maui/Regions/Behaviors/IRegionBehaviorFactory.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace Prism.Regions.Behaviors; - -/// -/// Interface for RegionBehaviorFactories. This factory allows the registration of the default set of RegionBehaviors, that will -/// be added to the s of all s, unless overridden on a 'per-region' basis. -/// -public interface IRegionBehaviorFactory : IEnumerable -{ - /// - /// Adds a particular type of RegionBehavior if it was not already registered. the string is used to check if the behavior is already present - /// - /// Type of the behavior to add. - /// The behavior key that's used to find if a certain behavior is already added. - void AddIfMissing(string behaviorKey) - where TBehavior : IRegionBehavior; - - /// - /// Determines whether a behavior with the specified key already exists - /// - /// The behavior key. - /// - /// if a behavior with the specified key is present; otherwise, . - /// - bool ContainsKey(string behaviorKey); - - /// - /// Creates an instance of the BehaviorType that's registered using the specified key. - /// - /// The key that's used to register a behavior type. - /// The created behavior. - IRegionBehavior CreateFromKey(string key); -} diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionActiveAwareBehavior.cs b/src/Maui/Prism.Maui/Regions/Behaviors/RegionActiveAwareBehavior.cs index 9a5ef6f31d..7d39ca2bf2 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionActiveAwareBehavior.cs +++ b/src/Maui/Prism.Maui/Regions/Behaviors/RegionActiveAwareBehavior.cs @@ -89,7 +89,7 @@ private void InvokeOnSynchronizedActiveAwareChildren(object item, Action e.ActiveViews); - var syncActiveViews = activeViews.Where(ShouldSyncActiveState); + var syncActiveViews = activeViews.OfType().Where(ShouldSyncActiveState); foreach (var syncActiveView in syncActiveViews) { diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehavior.cs b/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehavior.cs deleted file mode 100644 index 4fa96e2b6e..0000000000 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehavior.cs +++ /dev/null @@ -1,52 +0,0 @@ -using Prism.Properties; - -namespace Prism.Regions.Behaviors; - -/// -/// Provides a base class for region's behaviors. -/// -public abstract class RegionBehavior : IRegionBehavior -{ - private IRegion region; - - /// - /// Behavior's attached region. - /// - public IRegion Region - { - get => region; - set - { - if (IsAttached) - { - throw new InvalidOperationException(Resources.RegionBehaviorRegionCannotBeSetAfterAttach); - } - - region = value; - } - } - - /// - /// Returns if the behavior is attached to a region, otherwise. - /// - public bool IsAttached { get; private set; } - - /// - /// Attaches the behavior to the region. - /// - public void Attach() - { - if (region == null) - { - throw new InvalidOperationException(Resources.RegionBehaviorAttachCannotBeCallWithNullRegion); - } - - IsAttached = true; - OnAttach(); - } - - /// - /// Override this method to perform the logic after the behavior has been attached. - /// - protected abstract void OnAttach(); -} diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorCollection.cs b/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorCollection.cs deleted file mode 100644 index 23facd9c15..0000000000 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorCollection.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System.Collections; - -namespace Prism.Regions.Behaviors; - -/// -/// A collection of instances, that are stored and retrieved by Key. -/// -public class RegionBehaviorCollection : IRegionBehaviorCollection -{ - private readonly IRegion _region; - private readonly Dictionary _behaviors = new Dictionary(); - - /// - /// Initializes a new instance of the class and associates it with a region. - /// - /// The region to associate the behavior collection with. - public RegionBehaviorCollection(IRegion region) - { - _region = region; - } - - /// - /// Gets the with the specified key. - /// - /// The RegionBehavior that's registered with the key. - public IRegionBehavior this[string key] => _behaviors[key]; - - /// - /// Adds a to the collection, using the specified key as an indexer. - /// - /// The key that specifies the type of that's added. - /// The to add. - /// - /// Thrown is the parameter is Null, - /// or if the parameter is Null. - /// - /// Thrown if a behavior with the specified Key parameter already exists. - public void Add(string key, IRegionBehavior regionBehavior) - { - if (key == null) - throw new ArgumentNullException(nameof(key)); - - if (regionBehavior == null) - throw new ArgumentNullException(nameof(regionBehavior)); - - if (_behaviors.ContainsKey(key)) - throw new ArgumentException("Could not add duplicate behavior with same key.", nameof(key)); - - _behaviors.Add(key, regionBehavior); - regionBehavior.Region = _region; - - regionBehavior.Attach(); - } - - /// - /// Checks if a with the specified key is already present. - /// - /// The key to use to find a particular . - /// - public bool ContainsKey(string key) => _behaviors.ContainsKey(key); - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// A that can be used to iterate through the collection. - /// - public IEnumerator> GetEnumerator() => _behaviors.GetEnumerator(); - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - IEnumerator IEnumerable.GetEnumerator() => _behaviors.GetEnumerator(); -} diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorFactory.cs b/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorFactory.cs deleted file mode 100644 index 2a01232f72..0000000000 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionBehaviorFactory.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System.Collections; -using System.Globalization; -using Prism.Ioc; -using Prism.Properties; - -namespace Prism.Regions.Behaviors; - -/// -/// Defines a factory that allows the registration of the default set of , that will -/// be added to the of all s, unless overridden on a 'per-region' basis. -/// -public class RegionBehaviorFactory : IRegionBehaviorFactory -{ - private readonly IContainerProvider _container; - private readonly Dictionary _registeredBehaviors = new Dictionary(); - - /// - /// Initializes a new instance of . - /// - /// used to create the instance of the behavior from its . - public RegionBehaviorFactory(IContainerExtension container) - { - _container = container; - } - - /// - /// Adds a particular type of RegionBehavior if it was not already registered. The string is used to check if the behavior is already present - /// - /// Type of the behavior to add. - /// The behavior key that's used to find if a certain behavior is already added. - public void AddIfMissing(string behaviorKey) - where TBehavior : IRegionBehavior - { - if (behaviorKey == null) - { - throw new ArgumentNullException(nameof(behaviorKey)); - } - - var behaviorType = typeof(TBehavior); - - // Only add the behaviorKey if it doesn't already exists. - if (_registeredBehaviors.ContainsKey(behaviorKey)) - { - return; - } - - _registeredBehaviors.Add(behaviorKey, behaviorType); - } - - /// - /// Creates an instance of the behavior that is registered using the specified key. - /// - /// The key that is used to register a behavior type. - /// A new instance of the behavior. - public IRegionBehavior CreateFromKey(string key) - { - if (!ContainsKey(key)) - { - throw new ArgumentException( - string.Format(CultureInfo.CurrentUICulture, Resources.TypeWithKeyNotRegistered, key), nameof(key)); - } - - return (IRegionBehavior)_container.Resolve(_registeredBehaviors[key]); - } - - - /// - /// Returns an enumerator that iterates through the collection. - /// - /// - /// A that can be used to iterate through the collection. - /// - /// 1 - public IEnumerator GetEnumerator() => - _registeredBehaviors.Keys.GetEnumerator(); - - /// - /// Returns an enumerator that iterates through a collection. - /// - /// - /// An object that can be used to iterate through the collection. - /// - /// 2 - IEnumerator IEnumerable.GetEnumerator() => - GetEnumerator(); - - /// - /// Determines whether a behavior with the specified key already exists. - /// - /// The behavior key. - /// - /// if a behavior with the specified key is present; otherwise, . - /// - public bool ContainsKey(string behaviorKey) => - _registeredBehaviors.ContainsKey(behaviorKey); -} diff --git a/src/Maui/Prism.Maui/Regions/IRegion.cs b/src/Maui/Prism.Maui/Regions/IRegion.cs deleted file mode 100644 index 35412a9ca1..0000000000 --- a/src/Maui/Prism.Maui/Regions/IRegion.cs +++ /dev/null @@ -1,117 +0,0 @@ -using System.ComponentModel; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; - -namespace Prism.Regions; - -/// -/// Defines a model that can be used to compose views. -/// -public interface IRegion : INotifyPropertyChanged -{ - /// - /// Gets a readonly view of the collection of views in the region. - /// - /// An of all the added views. - IViewsCollection Views { get; } - - /// - /// Gets a readonly view of the collection of all the active views in the region. - /// - /// An of all the active views. - IViewsCollection ActiveViews { get; } - - /// - /// Gets or sets a context for the region. This value can be used by the user to share context with the views. - /// - /// The context value to be shared. - object Context { get; set; } - - /// - /// Gets the name of the region that uniquely identifies the region within a . - /// - /// The name of the region. - string Name { get; set; } - - /// - /// Gets or sets the comparison used to sort the views. - /// - /// The comparison to use. - Comparison SortComparison { get; set; } - - IRegionManager Add(string viewName); - - ///Adds a new view to the region. - /// - /// Adds a new view to the region. - /// - /// The view to add. - /// The that is set on the view if it is a . It will be the current region manager when using this overload. - IRegionManager Add(VisualElement view); - - /// - /// Adds a new view to the region. - /// - /// The view to add. - /// The name of the view. This can be used to retrieve it later by calling . - /// The that is set on the view if it is a . It will be the current region manager when using this overload. - IRegionManager Add(VisualElement view, string viewName); - - /// - /// Adds a new view to the region. - /// - /// The view to add. - /// The name of the view. This can be used to retrieve it later by calling . - /// When , the added view will receive a new instance of , otherwise it will use the current region manager for this region. - /// The that is set on the view if it is a . - IRegionManager Add(VisualElement view, string viewName, bool createRegionManagerScope); - - /// - /// Removes the specified view from the region. - /// - /// The view to remove. - void Remove(VisualElement view); - - /// - /// Removes all views from the region. - /// - void RemoveAll(); - - /// - /// Marks the specified view as active. - /// - /// The view to activate. - void Activate(VisualElement view); - - /// - /// Marks the specified view as inactive. - /// - /// The view to deactivate. - void Deactivate(VisualElement view); - - /// - /// Returns the view instance that was added to the region using a specific name. - /// - /// The name used when adding the view to the region. - /// Returns the named view or if the view with does not exist in the current region. - VisualElement GetView(string viewName); - - /// - /// Gets or sets the that will be passed to the views when adding them to the region, unless the view is added by specifying createRegionManagerScope as . - /// - /// The where this is registered. - /// This is usually used by implementations of and should not be - /// used by the developer explicitly. - IRegionManager RegionManager { get; set; } - - /// - /// Gets the collection of s that can extend the behavior of regions. - /// - IRegionBehaviorCollection Behaviors { get; } - - /// - /// Gets or sets the navigation service. - /// - /// The navigation service. - IRegionNavigationService NavigationService { get; } -} diff --git a/src/Maui/Prism.Maui/Regions/IRegionCollection.cs b/src/Maui/Prism.Maui/Regions/IRegionCollection.cs deleted file mode 100644 index c7cc0a7d61..0000000000 --- a/src/Maui/Prism.Maui/Regions/IRegionCollection.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System.Collections.Specialized; - -namespace Prism.Regions; - -/// -/// Defines a collection of uniquely identified by their Name. -/// -public interface IRegionCollection : IEnumerable, INotifyCollectionChanged -{ - /// - /// Gets the IRegion with the name received as index. - /// - /// Name of the region to be retrieved. - /// The identified with the requested name. - IRegion this[string regionName] { get; } - - /// - /// Adds a to the collection. - /// - /// Region to be added to the collection. - void Add(IRegion region); - - /// - /// Removes a from the collection. - /// - /// Name of the region to be removed. - /// if the region was removed from the collection, otherwise . - bool Remove(string regionName); - - /// - /// Checks if the collection contains a with the name received as parameter. - /// - /// The name of the region to look for. - /// if the region is contained in the collection, otherwise . - bool ContainsRegionWithName(string regionName); - - /// - /// Adds a region to the with the name received as argument. - /// - /// The name to be given to the region. - /// The region to be added to the . - /// Thrown if is . - /// Thrown if and 's name do not match and the is not . - void Add(string regionName, IRegion region); -} diff --git a/src/Maui/Prism.Maui/Regions/IRegionManager.cs b/src/Maui/Prism.Maui/Regions/IRegionManager.cs deleted file mode 100644 index 4e453a46a7..0000000000 --- a/src/Maui/Prism.Maui/Regions/IRegionManager.cs +++ /dev/null @@ -1,74 +0,0 @@ -using Prism.Navigation; -using Prism.Regions.Navigation; - -namespace Prism.Regions; - -/// -/// Defines an interface to manage a set of regions and to attach regions to objects (typically controls). -/// -public interface IRegionManager -{ - /// - /// Gets a collection of that identify each region by name. You can use this collection to add or remove regions to the current region manager. - /// - IRegionCollection Regions { get; } - - /// - /// Creates a new region manager. - /// - /// A new region manager that can be used as a different scope from the current region manager. - IRegionManager CreateRegionManager(); - - /// - /// Add a view to the Views collection of a Region. Note that the region must already exist in this . - /// - /// The name of the region to add a view to - /// The view to add to the views collection - /// The RegionManager, to easily add several views. - IRegionManager AddToRegion(string regionName, string targetName); - - /// - /// Associate a view with a region, by registering a type. When the region get's displayed - /// this type will be resolved using the ServiceLocator into a concrete instance. The instance - /// will be added to the Views collection of the region - /// - /// The name of the region to associate the view with. - /// The type of the view to register with the - /// The , for adding several views easily - IRegionManager RegisterViewWithRegion(string regionName, string targetName); - - /// - /// Associate a view with a region, by registering a type. When the region get's displayed - /// this type will be resolved using the ServiceLocator into a concrete instance. The instance - /// will be added to the Views collection of the region - /// - /// The name of the region to associate the view with. - /// The type of the view to register with the . - /// The , for adding several views easily - IRegionManager RegisterViewWithRegion(string regionName, Type viewType); - - /// - /// Initiates navigation to the target specified by the . - /// - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(string regionName, Uri target, Action navigationCallback); - - /// - /// Initiates navigation to the target specified by the . - /// - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// The navigation parameters specific to the navigation request. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(string regionName, Uri target, Action navigationCallback, INavigationParameters navigationParameters); -} diff --git a/src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs b/src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs index 4c7e9c06e3..03c1cd29a6 100644 --- a/src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs +++ b/src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs @@ -26,7 +26,7 @@ public static void RequestNavigate(this IRegionManager regionManager, string reg /// The name of the Region to navigate to. /// The navigation target /// The callback executed when the navigation request is completed. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback) + public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback) { if (regionManager == null) throw new ArgumentNullException(nameof(regionManager)); @@ -61,7 +61,7 @@ public static void RequestNavigate(this IRegionManager regionManager, string reg /// The navigation target /// The callback executed when the navigation request is completed. /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback, INavigationParameters regionParameters) + public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback, INavigationParameters regionParameters) { if (regionManager == null) throw new ArgumentNullException(nameof(regionManager)); diff --git a/src/Maui/Prism.Maui/Regions/IRegionViewRegistry.cs b/src/Maui/Prism.Maui/Regions/IRegionViewRegistry.cs deleted file mode 100644 index 1b28cc96cb..0000000000 --- a/src/Maui/Prism.Maui/Regions/IRegionViewRegistry.cs +++ /dev/null @@ -1,46 +0,0 @@ -using Prism.Ioc; - -namespace Prism.Regions; - -/// -/// Defines the interface for the registry of region's content. -/// -public interface IRegionViewRegistry -{ - /// - /// Event triggered when a content is registered to a region name. - /// - /// - /// This event uses weak references to the event handler to prevent this service (typically a singleton) of keeping the - /// target element longer than expected. - /// - event EventHandler ContentRegistered; - - /// - /// Returns the contents associated with a region name. - /// - /// Region name for which contents are requested. - /// Collection of contents associated with the . - IEnumerable GetContents(string regionName, IContainerProvider container); - - /// - /// Registers a content type with a region name. - /// - /// Region name to which the will be registered. - /// Content type to be registered for the . - void RegisterViewWithRegion(string regionName, Type viewType); - - /// - /// Registers a content type with a region name. - /// - /// Region name to which the will be registered. - /// Content type to be registered for the . - void RegisterViewWithRegion(string regionName, string targetName); - - /// - /// Registers a delegate that can be used to retrieve the content associated with a region name. - /// - /// Region name to which the will be registered. - /// Delegate used to retrieve the content associated with the . - void RegisterViewWithRegion(string regionName, Func getContentDelegate); -} diff --git a/src/Maui/Prism.Maui/Regions/IViewsCollection.cs b/src/Maui/Prism.Maui/Regions/IViewsCollection.cs deleted file mode 100644 index 079de4d1b7..0000000000 --- a/src/Maui/Prism.Maui/Regions/IViewsCollection.cs +++ /dev/null @@ -1,8 +0,0 @@ -using System.Collections.Specialized; - -namespace Prism.Regions; - -public interface IViewsCollection : IEnumerable, INotifyCollectionChanged -{ - bool Contains(VisualElement element); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IConfirmRegionNavigationRequest.cs b/src/Maui/Prism.Maui/Regions/Navigation/IConfirmRegionNavigationRequest.cs deleted file mode 100644 index fe3e0730d7..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IConfirmRegionNavigationRequest.cs +++ /dev/null @@ -1,18 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Provides a way for objects involved in navigation to determine if a navigation request should continue. -/// -public interface IConfirmRegionNavigationRequest : IRegionAware -{ - /// - /// Determines whether this instance accepts being navigated away from. - /// - /// The navigation context. - /// The callback to indicate when navigation can proceed. - /// - /// Implementors of this method do not need to invoke the callback before this method is completed, - /// but they must ensure the callback is eventually invoked. - /// - void ConfirmNavigationRequest(INavigationContext navigationContext, Action continuationCallback); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IJournalAware.cs b/src/Maui/Prism.Maui/Regions/Navigation/IJournalAware.cs deleted file mode 100644 index 5a3f2fa263..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IJournalAware.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Provides a way for objects involved in navigation to opt-out of being added to the IRegionNavigationJournal backstack. -/// -public interface IJournalAware -{ - /// - /// Determines if the current object is going to be added to the navigation journal's backstack. - /// - /// True, add to backstack. False, remove from backstack. - bool PersistInHistory(); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/INavigateAsync.cs b/src/Maui/Prism.Maui/Regions/Navigation/INavigateAsync.cs deleted file mode 100644 index 8916aa60da..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/INavigateAsync.cs +++ /dev/null @@ -1,36 +0,0 @@ -using Prism.Navigation; - -namespace Prism.Regions.Navigation; - -/// -/// Provides methods to perform navigation. -/// -/// -/// Convenience overloads for the methods in this interface can be found as extension methods on the -/// class. -/// -public interface INavigateAsync -{ - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation target - /// The callback executed when the navigation request is completed. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(Uri target, Action navigationCallback); - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation target - /// The callback executed when the navigation request is completed. - /// The navigation parameters specific to the navigation request. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/INavigationContext.cs b/src/Maui/Prism.Maui/Regions/Navigation/INavigationContext.cs deleted file mode 100644 index 4f7c2c1b7b..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/INavigationContext.cs +++ /dev/null @@ -1,27 +0,0 @@ -using Prism.Navigation; - -namespace Prism.Regions.Navigation; - -/// -/// Encapsulates information about a navigation request. -/// -public interface INavigationContext -{ - /// - /// Gets the region navigation service. - /// - /// The navigation service. - IRegionNavigationService NavigationService { get; } - - /// - /// Gets the extracted from the URI and the object parameters passed in navigation. - /// - /// The URI query. - INavigationParameters Parameters { get; } - - /// - /// Gets the navigation URI. - /// - /// The navigation URI. - Uri Uri { get; } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/INavigationContextExtensions.cs b/src/Maui/Prism.Maui/Regions/Navigation/INavigationContextExtensions.cs deleted file mode 100644 index 922958ba45..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/INavigationContextExtensions.cs +++ /dev/null @@ -1,15 +0,0 @@ -namespace Prism.Regions.Navigation; - -public static class INavigationContextExtensions -{ - public static string NavigatedName(this INavigationContext context) - { - var uri = context.Uri; - if (!uri.IsAbsoluteUri) - { - uri = new Uri(new Uri("nav://local.app"), context.Uri); - } - - return uri.LocalPath.StartsWith("/") ? uri.LocalPath.Substring(1) : uri.LocalPath; - } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IRegionAware.cs b/src/Maui/Prism.Maui/Regions/Navigation/IRegionAware.cs deleted file mode 100644 index dca06b7776..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IRegionAware.cs +++ /dev/null @@ -1,28 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Provides a way for objects involved in navigation to be notified of navigation activities. -/// -public interface IRegionAware -{ - /// - /// Called when the implementer has been navigated to. - /// - /// The navigation context. - void OnNavigatedTo(INavigationContext navigationContext); - - /// - /// Called to determine if this instance can handle the navigation request. - /// - /// The navigation context. - /// - /// if this instance accepts the navigation request; otherwise, . - /// - bool IsNavigationTarget(INavigationContext navigationContext); - - /// - /// Called when the implementer is being navigated away from. - /// - /// The navigation context. - void OnNavigatedFrom(INavigationContext navigationContext); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationContentLoader.cs b/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationContentLoader.cs deleted file mode 100644 index 6c015d26ca..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationContentLoader.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Identifies the view in a region that is the target of a navigation request. -/// -public interface IRegionNavigationContentLoader -{ - /// - /// Gets the content to which the navigation request represented by applies. - /// - /// - /// If none of the items in the region match the target of the navigation request, a new item - /// will be created and added to the region. - /// - /// The region. - /// The context representing the navigation request. - /// The item to be the target of the navigation request. - /// when a new item cannot be created for the navigation request. - object LoadContent(IRegion region, INavigationContext navigationContext); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournal.cs b/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournal.cs deleted file mode 100644 index 3f58c4da25..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournal.cs +++ /dev/null @@ -1,60 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Provides journaling of current, back, and forward navigation within regions. -/// -public interface IRegionNavigationJournal -{ - /// - /// Gets a value that indicates whether there is at least one entry in the back navigation history. - /// - /// - /// true if the journal can go back; otherwise, false. - /// - bool CanGoBack { get; } - - /// - /// Gets a value that indicates whether there is at least one entry in the forward navigation history. - /// - /// - /// true if this instance can go forward; otherwise, false. - /// - bool CanGoForward { get; } - - /// - /// Gets the current navigation entry of the content that is currently displayed. - /// - /// The current entry. - IRegionNavigationJournalEntry CurrentEntry { get; } - - /// - /// Gets or sets the target that implements INavigateAsync. - /// - /// The INavigate implementation. - /// - /// This is set by the owner of this journal. - /// - INavigateAsync NavigationTarget { get; set; } - - /// - /// Navigates to the most recent entry in the back navigation history, or does nothing if no entry exists in back navigation. - /// - void GoBack(); - - /// - /// Navigates to the most recent entry in the forward navigation history, or does nothing if no entry exists in forward navigation. - /// - void GoForward(); - - /// - /// Records the navigation to the entry.. - /// - /// The entry to record. - /// true if you it should be persisted in history - void RecordNavigation(IRegionNavigationJournalEntry entry, bool persistInHistory); - - /// - /// Clears the journal of current, back, and forward navigation histories. - /// - void Clear(); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournalEntry.cs b/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournalEntry.cs deleted file mode 100644 index 607f2ec4c7..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationJournalEntry.cs +++ /dev/null @@ -1,20 +0,0 @@ -using Prism.Navigation; - -namespace Prism.Regions.Navigation; - -/// -/// An entry in an IRegionNavigationJournal representing the URI navigated to. -/// -public interface IRegionNavigationJournalEntry -{ - /// - /// Gets or sets the URI. - /// - /// The URI. - Uri Uri { get; set; } - - /// - /// Gets or sets the NavigationParameters instance. - /// - INavigationParameters Parameters { get; set; } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationResult.cs b/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationResult.cs deleted file mode 100644 index 9932311a7d..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationResult.cs +++ /dev/null @@ -1,25 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Represents the result of navigating to a URI. -/// -public interface IRegionNavigationResult -{ - /// - /// Gets the navigation context. - /// - /// The navigation context. - INavigationContext Context { get; } - - /// - /// Gets an exception that occurred while navigating. - /// - /// The exception. - Exception Error { get; } - - /// - /// Gets the result. - /// - /// The result. - bool? Result { get; } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationService.cs b/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationService.cs deleted file mode 100644 index 2c12f5ebe8..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/IRegionNavigationService.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Provides navigation for regions. -/// -public interface IRegionNavigationService : INavigateAsync -{ - /// - /// Gets or sets the region owning this service. - /// - /// A Region. - IRegion Region { get; set; } - - /// - /// Gets the journal. - /// - /// The journal. - IRegionNavigationJournal Journal { get; } - - /// - /// Raised when the region is about to be navigated to content. - /// - event EventHandler Navigating; - - /// - /// Raised when the region is navigated to content. - /// - event EventHandler Navigated; - - /// - /// Raised when a navigation request fails. - /// - event EventHandler NavigationFailed; -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs b/src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs index 6b751fca31..d3e4c0d48a 100644 --- a/src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs +++ b/src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs @@ -23,7 +23,7 @@ public static void RequestNavigate(this INavigateAsync navigation, string target /// The navigation object. /// The navigation target /// The callback executed when the navigation request is completed. - public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback) + public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback) { if (navigation == null) throw new ArgumentNullException(nameof(navigation)); @@ -56,7 +56,7 @@ public static void RequestNavigate(this INavigateAsync navigation, Uri target) /// The navigation target /// The callback executed when the navigation request is completed. /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback, INavigationParameters regionParameters) + public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback, INavigationParameters regionParameters) { if (navigation == null) throw new ArgumentNullException(nameof(navigation)); diff --git a/src/Maui/Prism.Maui/Regions/Navigation/NavigationContext.cs b/src/Maui/Prism.Maui/Regions/Navigation/NavigationContext.cs deleted file mode 100644 index e6bd59450a..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/NavigationContext.cs +++ /dev/null @@ -1,67 +0,0 @@ -using Prism.Common; -using Prism.Navigation; - -namespace Prism.Regions.Navigation; - -/// -/// Encapsulates information about a navigation request. -/// -public class NavigationContext : INavigationContext -{ - /// - /// Initializes a new instance of the class for a region name and a - /// . - /// - /// The navigation service. - /// The Uri. - public NavigationContext(IRegionNavigationService navigationService, Uri uri) - : this(navigationService, uri, null) - { - } - - /// - /// Initializes a new instance of the class for a region name and a - /// . - /// - /// The navigation service. - /// The navigation parameters. - /// The Uri. - public NavigationContext(IRegionNavigationService navigationService, Uri uri, INavigationParameters regionParameters) - { - NavigationService = navigationService; - Uri = uri; - Parameters = regionParameters ?? new NavigationParameters(); - - var queryString = uri != null ? UriParsingHelper.EnsureAbsolute(uri).Query : null; - if (!string.IsNullOrEmpty(queryString)) - { - UpdateRegionParameters(new NavigationParameters(queryString)); - } - } - - /// - /// Gets the region navigation service. - /// - /// The navigation service. - public IRegionNavigationService NavigationService { get; private set; } - - /// - /// Gets the navigation URI. - /// - /// The navigation URI. - public Uri Uri { get; } - - /// - /// Gets the extracted from the URI and the object parameters passed in navigation. - /// - /// The URI query. - public INavigationParameters Parameters { get; } - - private void UpdateRegionParameters(INavigationParameters regionParameters) - { - foreach (KeyValuePair parameter in regionParameters) - { - Parameters.Add(parameter.Key, parameter.Value); - } - } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationContentLoader.cs b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationContentLoader.cs index 12f6cf2add..ab89676305 100644 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationContentLoader.cs +++ b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationContentLoader.cs @@ -1,7 +1,6 @@ using System.Globalization; using Prism.Common; using Prism.Ioc; -using Prism.Ioc.Internals; using Prism.Mvvm; using Prism.Properties; @@ -26,7 +25,7 @@ public class RegionNavigationContentLoader : IRegionNavigationContentLoader /// is created and added to the region. /// /// when a new view cannot be created for the navigation request. - public object LoadContent(IRegion region, INavigationContext navigationContext) + public object LoadContent(IRegion region, NavigationContext navigationContext) { if (region == null) throw new ArgumentNullException(nameof(region)); @@ -88,7 +87,7 @@ protected virtual object CreateNewRegionItem(string candidateTargetContract, IRe /// /// The navigation contract. /// The candidate contract to seek within the and to use, if not found, when resolving from the container. - protected virtual string GetContractFromNavigationContext(INavigationContext navigationContext) + protected virtual string GetContractFromNavigationContext(NavigationContext navigationContext) { if (navigationContext == null) throw new ArgumentNullException(nameof(navigationContext)); @@ -134,7 +133,7 @@ protected virtual IEnumerable GetCandidatesFromRegion(IRegion reg private IEnumerable GetCandidatesFromRegionViews(IRegion region, string candidateNavigationContract) { - return region.Views.Where(v => ViewIsMatch(v.GetType(), candidateNavigationContract)); + return region.Views.OfType().Where(v => ViewIsMatch(v.GetType(), candidateNavigationContract)); } private static bool ViewIsMatch(Type viewType, string navigationSegment) diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationEventArgs.cs b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationEventArgs.cs deleted file mode 100644 index 0b8eb7cd77..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationEventArgs.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// EventArgs used with the Navigated event. -/// -public class RegionNavigationEventArgs : EventArgs -{ - /// - /// Initializes a new instance of the class. - /// - /// The navigation context. - public RegionNavigationEventArgs(INavigationContext navigationContext) - { - NavigationContext = navigationContext ?? throw new ArgumentNullException(nameof(navigationContext)); - } - - /// - /// Gets the navigation context. - /// - /// The navigation context. - public INavigationContext NavigationContext { get; } - - /// - /// Gets the navigation URI - /// - /// The URI. - /// - /// This is a convenience accessor around NavigationContext.Uri. - /// - public Uri Uri => NavigationContext?.Uri; -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationFailedEventArgs.cs b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationFailedEventArgs.cs deleted file mode 100644 index 00a827971f..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationFailedEventArgs.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// EventArgs used with the NavigationFailed event. -/// -public class RegionNavigationFailedEventArgs : EventArgs -{ - /// - /// Initializes a new instance of the class. - /// - /// The navigation context. - public RegionNavigationFailedEventArgs(INavigationContext navigationContext) - { - NavigationContext = navigationContext ?? throw new ArgumentNullException(nameof(navigationContext)); - } - - /// - /// Initializes a new instance of the class. - /// - /// The navigation context. - /// The error. - public RegionNavigationFailedEventArgs(INavigationContext navigationContext, Exception error) - : this(navigationContext) - { - Error = error; - } - - /// - /// Gets the navigation context. - /// - /// The navigation context. - public INavigationContext NavigationContext { get; } - - /// - /// Gets the error. - /// - /// The , or if the failure was not caused by an exception. - public Exception Error { get; } - - /// - /// Gets the navigation URI - /// - /// The URI. - /// - /// This is a convenience accessor around NavigationContext.Uri. - /// - public Uri Uri => NavigationContext?.Uri; -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournal.cs b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournal.cs deleted file mode 100644 index d30bd7a89f..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournal.cs +++ /dev/null @@ -1,143 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Provides journaling of current, back, and forward navigation within regions. -/// -public class RegionNavigationJournal : IRegionNavigationJournal -{ - private readonly Stack _backStack = new Stack(); - private readonly Stack _forwardStack = new Stack(); - - private bool _isNavigatingInternal; - - /// - /// Gets or sets the target that implements INavigate. - /// - /// The INavigate implementation. - /// - /// This is set by the owner of this journal. - /// - public INavigateAsync NavigationTarget { get; set; } - - /// - /// Gets the current navigation entry of the content that is currently displayed. - /// - /// The current entry. - public IRegionNavigationJournalEntry CurrentEntry { get; private set; } - - /// - /// Gets a value that indicates whether there is at least one entry in the back navigation history. - /// - /// true if the journal can go back; otherwise, false. - public bool CanGoBack => _backStack.Count > 0; - - /// - /// Gets a value that indicates whether there is at least one entry in the forward navigation history. - /// - /// - /// true if this instance can go forward; otherwise, false. - /// - public bool CanGoForward => _forwardStack.Count > 0; - - /// - /// Navigates to the most recent entry in the back navigation history, or does nothing if no entry exists in back navigation. - /// - public void GoBack() - { - if (CanGoBack) - { - IRegionNavigationJournalEntry entry = _backStack.Peek(); - InternalNavigate( - entry, - result => - { - if (result) - { - if (CurrentEntry != null) - { - _forwardStack.Push(CurrentEntry); - } - - _backStack.Pop(); - CurrentEntry = entry; - } - }); - } - } - - /// - /// Navigates to the most recent entry in the forward navigation history, or does nothing if no entry exists in forward navigation. - /// - public void GoForward() - { - if (CanGoForward) - { - IRegionNavigationJournalEntry entry = _forwardStack.Peek(); - InternalNavigate( - entry, - result => - { - if (result) - { - if (CurrentEntry != null) - { - _backStack.Push(CurrentEntry); - } - - _forwardStack.Pop(); - CurrentEntry = entry; - } - }); - } - } - - /// - /// Records the navigation to the entry.. - /// - /// The entry to record. - /// Determine if the view is added to the back stack or excluded from the history. - public void RecordNavigation(IRegionNavigationJournalEntry entry, bool persistInHistory) - { - if (!_isNavigatingInternal) - { - if (CurrentEntry != null) - { - _backStack.Push(CurrentEntry); - } - - _forwardStack.Clear(); - - if (persistInHistory) - CurrentEntry = entry; - else - CurrentEntry = null; - } - } - - /// - /// Clears the journal of current, back, and forward navigation histories. - /// - public void Clear() - { - CurrentEntry = null; - _backStack.Clear(); - _forwardStack.Clear(); - } - - private void InternalNavigate(IRegionNavigationJournalEntry entry, Action callback) - { - _isNavigatingInternal = true; - NavigationTarget.RequestNavigate( - entry.Uri, - nr => - { - _isNavigatingInternal = false; - - if (nr.Result.HasValue) - { - callback(nr.Result.Value); - } - }, - entry.Parameters); - } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournalEntry.cs b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournalEntry.cs deleted file mode 100644 index 7c7f60acc3..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationJournalEntry.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System.Globalization; -using Prism.Navigation; - -namespace Prism.Regions.Navigation; - -/// -/// An entry in an IRegionNavigationJournal representing the URI navigated to. -/// -public class RegionNavigationJournalEntry : IRegionNavigationJournalEntry -{ - /// - /// Gets or sets the URI. - /// - /// The URI. - public Uri Uri { get; set; } - - /// - /// Gets or sets the NavigationParameters instance. - /// - public INavigationParameters Parameters { get; set; } - - /// - /// Returns a that represents this instance. - /// - /// - /// A that represents this instance. - /// - public override string ToString() - { - if (Uri != null) - { - return string.Format(CultureInfo.CurrentCulture, "RegionNavigationJournalEntry:'{0}'", Uri.ToString()); - } - - return base.ToString(); - } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationResult.cs b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationResult.cs deleted file mode 100644 index b14f6a6213..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationResult.cs +++ /dev/null @@ -1,48 +0,0 @@ -namespace Prism.Regions.Navigation; - -/// -/// Represents the result of navigating to a URI. -/// -public class RegionNavigationResult : IRegionNavigationResult -{ - /// - /// Initializes a new instance of the class. - /// - /// The context. - /// The result. - public RegionNavigationResult(INavigationContext context, bool? result) - { - Context = context; - Result = result; - } - - /// - /// Initializes a new instance of the class. - /// - /// The context. - /// The error. - public RegionNavigationResult(INavigationContext context, Exception error) - { - Context = context; - Error = error; - Result = false; - } - - /// - /// Gets the result. - /// - /// The result. - public bool? Result { get; } - - /// - /// Gets an exception that occurred while navigating. - /// - /// The exception. - public Exception Error { get; } - - /// - /// Gets the navigation context. - /// - /// The navigation context. - public INavigationContext Context { get; } -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationService.cs b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationService.cs index 2b9c3c4a12..1df06691a3 100644 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationService.cs +++ b/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationService.cs @@ -45,7 +45,7 @@ public RegionNavigationService(IContainerExtension container, IRegionNavigationC /// public event EventHandler Navigating; - private void RaiseNavigating(INavigationContext navigationContext) + private void RaiseNavigating(NavigationContext navigationContext) { Navigating?.Invoke(this, new RegionNavigationEventArgs(navigationContext)); } @@ -55,7 +55,7 @@ private void RaiseNavigating(INavigationContext navigationContext) /// public event EventHandler Navigated; - private void RaiseNavigated(INavigationContext navigationContext) + private void RaiseNavigated(NavigationContext navigationContext) { Navigated?.Invoke(this, new RegionNavigationEventArgs(navigationContext)); } @@ -65,7 +65,7 @@ private void RaiseNavigated(INavigationContext navigationContext) /// public event EventHandler NavigationFailed; - private void RaiseNavigationFailed(INavigationContext navigationContext, Exception error) + private void RaiseNavigationFailed(NavigationContext navigationContext, Exception error) { NavigationFailed?.Invoke(this, new RegionNavigationFailedEventArgs(navigationContext, error)); } @@ -75,7 +75,7 @@ private void RaiseNavigationFailed(INavigationContext navigationContext, Excepti /// /// The target. /// A callback to execute when the navigation request is completed. - public void RequestNavigate(Uri target, Action navigationCallback) + public void RequestNavigate(Uri target, Action navigationCallback) { RequestNavigate(target, navigationCallback, null); } @@ -86,7 +86,7 @@ public void RequestNavigate(Uri target, Action navigati /// The target. /// A callback to execute when the navigation request is completed. /// The navigation parameters specific to the navigation request. - public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters regionParameters) + public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters regionParameters) { if (navigationCallback == null) throw new ArgumentNullException(nameof(navigationCallback)); @@ -101,7 +101,7 @@ public void RequestNavigate(Uri target, Action navigati } } - private void DoNavigate(Uri source, Action navigationCallback, INavigationParameters regionParameters) + private void DoNavigate(Uri source, Action navigationCallback, INavigationParameters regionParameters) { if (source == null) throw new ArgumentNullException(nameof(source)); @@ -115,19 +115,19 @@ private void DoNavigate(Uri source, Action navigationCa RequestCanNavigateFromOnCurrentlyActiveView( _currentNavigationContext, navigationCallback, - Region.ActiveViews.ToArray(), + Region.ActiveViews.OfType().ToArray(), 0); } private void RequestCanNavigateFromOnCurrentlyActiveView( - INavigationContext navigationContext, - Action navigationCallback, + NavigationContext navigationContext, + Action navigationCallback, VisualElement[] activeViews, int currentViewIndex) { if (currentViewIndex < activeViews.Length) { - if (activeViews[currentViewIndex] is IConfirmRegionNavigationRequest vetoingView) + if (activeViews[currentViewIndex] is IConfirmNavigationRequest vetoingView) { // the current active view implements IConfirmNavigationRequest, request confirmation // providing a callback to resume the navigation request @@ -165,12 +165,12 @@ private void RequestCanNavigateFromOnCurrentlyActiveView( } private void RequestCanNavigateFromOnCurrentlyActiveViewModel( - INavigationContext navigationContext, - Action navigationCallback, + NavigationContext navigationContext, + Action navigationCallback, VisualElement[] activeViews, int currentViewIndex) { - if (activeViews[currentViewIndex].BindingContext is IConfirmRegionNavigationRequest vetoingViewModel) + if (activeViews[currentViewIndex].BindingContext is IConfirmNavigationRequest vetoingViewModel) { // the data model for the current active view implements IConfirmNavigationRequest, request confirmation // providing a callback to resume the navigation request @@ -202,7 +202,7 @@ private void RequestCanNavigateFromOnCurrentlyActiveViewModel( currentViewIndex + 1); } - private void ExecuteNavigation(INavigationContext navigationContext, object[] activeViews, Action navigationCallback) + private void ExecuteNavigation(NavigationContext navigationContext, object[] activeViews, Action navigationCallback) { try { @@ -227,7 +227,7 @@ private void ExecuteNavigation(INavigationContext navigationContext, object[] ac // The view can be informed of navigation MvvmHelpers.OnNavigatedTo(view, navigationContext); - navigationCallback(new RegionNavigationResult(navigationContext, true)); + navigationCallback(new NavigationResult(navigationContext, true)); // Raise the navigated event when navigation is completed. RaiseNavigated(navigationContext); @@ -245,20 +245,20 @@ private static bool PersistInHistory(object view) return persist; } - private void NotifyNavigationFailed(INavigationContext navigationContext, Action navigationCallback, Exception e) + private void NotifyNavigationFailed(NavigationContext navigationContext, Action navigationCallback, Exception e) { var navigationResult = - e != null ? new RegionNavigationResult(navigationContext, e) : new RegionNavigationResult(navigationContext, false); + e != null ? new NavigationResult(navigationContext, e) : new NavigationResult(navigationContext, false); navigationCallback(navigationResult); RaiseNavigationFailed(navigationContext, e); } - private static void NotifyActiveViewsNavigatingFrom(INavigationContext navigationContext, object[] activeViews) + private static void NotifyActiveViewsNavigatingFrom(NavigationContext navigationContext, object[] activeViews) { foreach (var item in activeViews) { MvvmHelpers.OnNavigatedFrom(item, navigationContext); } } -} \ No newline at end of file +} diff --git a/src/Maui/Prism.Maui/Regions/Region.cs b/src/Maui/Prism.Maui/Regions/Region.cs index 3b59d79e17..cee2644137 100644 --- a/src/Maui/Prism.Maui/Regions/Region.cs +++ b/src/Maui/Prism.Maui/Regions/Region.cs @@ -2,10 +2,9 @@ using System.Globalization; using Prism.Ioc; using Prism.Mvvm; +using Prism.Navigation; using Prism.Navigation.Xaml; using Prism.Properties; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; namespace Prism.Regions; @@ -17,7 +16,7 @@ public class Region : BindableBase, IRegion, ITargetAwareRegion private ObservableCollection _itemMetadataCollection; private IRegionManager _regionManager; private readonly IRegionNavigationService _regionNavigationService; - private Comparison _sort; + private Comparison _sort; /// /// Initializes a new instance of . @@ -122,7 +121,7 @@ public string Name /// Gets or sets the comparison used to sort the views. /// /// The comparison to use. - public Comparison SortComparison + public Comparison SortComparison { get => _sort; set @@ -162,7 +161,11 @@ public IRegionManager RegionManager /// Gets the navigation service. /// /// The navigation service. - public IRegionNavigationService NavigationService => _regionNavigationService; + public IRegionNavigationService NavigationService + { + get => _regionNavigationService; + set => throw new NotImplementedException(); + } /// /// Gets the collection with all the views along with their metadata. @@ -185,7 +188,7 @@ protected virtual ObservableCollection ItemMetadataCollection /// Marks the specified view as active. /// /// The view to activate. - public virtual void Activate(VisualElement view) + public virtual void Activate(object view) { var itemMetadata = GetItemMetadataOrThrow(view); @@ -199,7 +202,7 @@ public virtual void Activate(VisualElement view) /// Marks the specified view as inactive. /// /// The view to deactivate. - public virtual void Deactivate(VisualElement view) + public virtual void Deactivate(object view) { var itemMetadata = GetItemMetadataOrThrow(view); @@ -223,7 +226,7 @@ public IRegionManager Add(string viewName) /// /// The view to add. /// The that is set on the view if it is a . It will be the current region manager when using this overload. - public IRegionManager Add(VisualElement view) + public IRegionManager Add(object view) { return Add(view, null, false); } @@ -234,7 +237,7 @@ public IRegionManager Add(VisualElement view) /// The view to add. /// The name of the view. This can be used to retrieve it later by calling . /// The that is set on the view if it is a . It will be the current region manager when using this overload. - public IRegionManager Add(VisualElement view, string viewName) + public IRegionManager Add(object view, string viewName) { if (string.IsNullOrEmpty(viewName)) { @@ -251,21 +254,26 @@ public IRegionManager Add(VisualElement view, string viewName) /// The name of the view. This can be used to retrieve it later by calling . /// When , the added view will receive a new instance of , otherwise it will use the current region manager for this region. /// The that is set on the view if it is a . - public virtual IRegionManager Add(VisualElement view, string viewName, bool createRegionManagerScope) + public virtual IRegionManager Add(object view, string viewName, bool createRegionManagerScope) { IRegionManager manager = createRegionManagerScope ? RegionManager.CreateRegionManager() : RegionManager; InnerAdd(view, viewName, manager); return manager; } - private void InnerAdd(VisualElement view, string viewName, IRegionManager scopedRegionManager) + private void InnerAdd(object view, string viewName, IRegionManager scopedRegionManager) { + if (view is not VisualElement visualElement) + { + throw new Exception("The view must inherit from VisualElement."); + } + if (ItemMetadataCollection.FirstOrDefault(x => x.Item == view) != null) { throw new InvalidOperationException(Resources.RegionViewExistsException); } - var itemMetadata = new ItemMetadata(view); + var itemMetadata = new ItemMetadata(visualElement); if (!string.IsNullOrEmpty(viewName)) { if (ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName) != null) @@ -275,7 +283,7 @@ private void InnerAdd(VisualElement view, string viewName, IRegionManager scoped itemMetadata.Name = viewName; } - Xaml.RegionManager.SetRegionManager(view, scopedRegionManager); + Xaml.RegionManager.SetRegionManager(visualElement, scopedRegionManager); ItemMetadataCollection.Add(itemMetadata); } @@ -285,7 +293,7 @@ private void InnerAdd(VisualElement view, string viewName, IRegionManager scoped /// /// The name used when adding the view to the region. /// Returns the named view or if the view with does not exist in the current region. - public virtual VisualElement GetView(string viewName) + public virtual object GetView(string viewName) { if (string.IsNullOrEmpty(viewName)) { @@ -306,15 +314,20 @@ public virtual VisualElement GetView(string viewName) /// Removes the specified view from the region. /// /// The view to remove. - public void Remove(VisualElement view) + public void Remove(object view) { + if (view is not VisualElement visualElement) + { + throw new Exception("The view must inherit from VisualElement."); + } + var itemMetadata = GetItemMetadataOrThrow(view); ItemMetadataCollection.Remove(itemMetadata); - if (Xaml.RegionManager.GetRegionManager(view) == RegionManager) + if (Xaml.RegionManager.GetRegionManager(visualElement) == RegionManager) { - view.ClearValue(Xaml.RegionManager.RegionManagerProperty); + visualElement.ClearValue(Xaml.RegionManager.RegionManagerProperty); } } @@ -399,4 +412,7 @@ private static int ViewSortHintAttributeComparison(ViewSortHintAttribute x, View } } } + + public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) => + NavigationService.RequestNavigate(target, navigationCallback, navigationParameters); } diff --git a/src/Maui/Prism.Maui/Regions/RegionManager.cs b/src/Maui/Prism.Maui/Regions/RegionManager.cs index e89a2ce7dc..76c366c1fb 100644 --- a/src/Maui/Prism.Maui/Regions/RegionManager.cs +++ b/src/Maui/Prism.Maui/Regions/RegionManager.cs @@ -1,8 +1,6 @@ using Prism.Ioc; -using Prism.Ioc.Internals; using Prism.Navigation; using Prism.Properties; -using Prism.Regions.Navigation; namespace Prism.Regions; @@ -43,6 +41,20 @@ public IRegionManager AddToRegion(string regionName, string targetName) return region.Add(targetName); } + /// + /// Add a view to the Views collection of a Region. Note that the region must already exist in this . + /// + /// The name of the region to add a view to + /// The view to add to the views collection + /// The RegionManager, to easily add several views. + public IRegionManager AddToRegion(string regionName, object view) + { + if (!Regions.ContainsRegionWithName(regionName)) + throw new ArgumentException(string.Format(Thread.CurrentThread.CurrentCulture, Resources.RegionNotFound, regionName), nameof(regionName)); + + return Regions[regionName].Add(view); + } + /// /// Creates a new region manager. /// @@ -80,13 +92,30 @@ public IRegionManager RegisterViewWithRegion(string regionName, string targetNam return this; } + /// + /// Associate a view with a region, using a delegate to resolve a concrete instance of the view. + /// When the region get's displayed, this delegate will be called and the result will be added to the + /// views collection of the region. + /// + /// The name of the region to associate the view with. + /// The delegate used to resolve a concrete instance of the view. + /// The , for adding several views easily + public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) + { + var regionViewRegistry = ContainerLocator.Container.Resolve(); + + regionViewRegistry.RegisterViewWithRegion(regionName, getContentDelegate); + + return this; + } + /// /// Navigates the specified region manager. /// /// The name of the region to call Navigate on. /// The URI of the content to display. /// The navigation callback. - public void RequestNavigate(string regionName, Uri target, Action navigationCallback) => + public void RequestNavigate(string regionName, Uri target, Action navigationCallback) => RequestNavigate(regionName, target, navigationCallback, null); /// @@ -96,7 +125,7 @@ public void RequestNavigate(string regionName, Uri target, ActionA that represents the target where the region will navigate. /// The navigation callback that will be executed after the navigation is completed. /// An instance of , which holds a collection of object parameters. - public void RequestNavigate(string regionName, Uri target, Action navigationCallback, INavigationParameters navigationParameters) + public void RequestNavigate(string regionName, Uri target, Action navigationCallback, INavigationParameters navigationParameters) { try { @@ -113,7 +142,7 @@ public void RequestNavigate(string regionName, Uri target, Action -/// When is applied to class provides data -/// the can use to determine if the instance should -/// be removed when it is deactivated. -/// -[AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)] -public sealed class RegionMemberLifetimeAttribute : Attribute -{ - /// - /// Instantiates an instance of - /// - public RegionMemberLifetimeAttribute() - { - KeepAlive = true; - } - - /// - /// Determines if the region member should be kept-alive - /// when deactivated. - /// - public bool KeepAlive { get; set; } -} diff --git a/src/Maui/Prism.Maui/Regions/RegionViewRegistry.cs b/src/Maui/Prism.Maui/Regions/RegionViewRegistry.cs index 094d43391a..dc2695c214 100644 --- a/src/Maui/Prism.Maui/Regions/RegionViewRegistry.cs +++ b/src/Maui/Prism.Maui/Regions/RegionViewRegistry.cs @@ -28,6 +28,7 @@ public event EventHandler ContentRegistered /// /// Returns the contents registered for a region. /// + /// The to use. /// Name of the region which content is being requested. /// Collection of contents registered for the region. public IEnumerable GetContents(string regionName, IContainerProvider container) diff --git a/src/Maui/Prism.Maui/Regions/SingleActiveRegion.cs b/src/Maui/Prism.Maui/Regions/SingleActiveRegion.cs index 6f19becc97..dc31b56e26 100644 --- a/src/Maui/Prism.Maui/Regions/SingleActiveRegion.cs +++ b/src/Maui/Prism.Maui/Regions/SingleActiveRegion.cs @@ -7,6 +7,10 @@ namespace Prism.Regions; /// public class SingleActiveRegion : Region { + /// + /// Creates a new . + /// + /// public SingleActiveRegion(IRegionNavigationService regionNavigationService) : base(regionNavigationService) { @@ -18,7 +22,7 @@ public SingleActiveRegion(IRegionNavigationService regionNavigationService) /// The view to activate. /// If there is an active view before calling this method, /// that view will be deactivated automatically. - public override void Activate(VisualElement view) + public override void Activate(object view) { var currentActiveView = ActiveViews.FirstOrDefault(); diff --git a/src/Maui/Prism.Maui/Regions/SyncActiveStateAttribute.cs b/src/Maui/Prism.Maui/Regions/SyncActiveStateAttribute.cs deleted file mode 100644 index bd2df43f28..0000000000 --- a/src/Maui/Prism.Maui/Regions/SyncActiveStateAttribute.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Prism.Regions; - -/// -/// Defines that a view is synchronized with its parent view's Active state. -/// -[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] -public sealed class SyncActiveStateAttribute : Attribute -{ -} diff --git a/src/Maui/Prism.Maui/Regions/UpdateRegionsException.cs b/src/Maui/Prism.Maui/Regions/UpdateRegionsException.cs deleted file mode 100644 index 5620511432..0000000000 --- a/src/Maui/Prism.Maui/Regions/UpdateRegionsException.cs +++ /dev/null @@ -1,48 +0,0 @@ -using System.Runtime.Serialization; - -namespace Prism.Regions; - -/// -/// Represents errors that occured during the regions' update. -/// -[Serializable] -public class UpdateRegionsException : Exception -{ - /// - /// Initializes a new instance of the - /// - public UpdateRegionsException() - { - } - - /// - /// Initializes a new instance of the class with a specified error message. - /// - /// The message that describes the error. - public UpdateRegionsException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class with a specified error message and a reference - /// to the inner exception that is the cause of this exception. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference - /// (Nothing in Visual Basic) if no inner exception is specified. - public UpdateRegionsException(string message, Exception inner) - : base(message, inner) - { - } - - /// - /// Initializes a new instance of the class with serialized data. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected UpdateRegionsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -} diff --git a/src/Maui/Prism.Maui/Regions/ViewRegisteredEventArgs.cs b/src/Maui/Prism.Maui/Regions/ViewRegisteredEventArgs.cs deleted file mode 100644 index d0b29c82e1..0000000000 --- a/src/Maui/Prism.Maui/Regions/ViewRegisteredEventArgs.cs +++ /dev/null @@ -1,30 +0,0 @@ -using Prism.Ioc; - -namespace Prism.Regions; - -/// -/// Argument class used by the event when a new content is registered. -/// -public class ViewRegisteredEventArgs : EventArgs -{ - /// - /// Initializes the ViewRegisteredEventArgs class. - /// - /// The region name to which the content was registered. - /// The content which was registered. - public ViewRegisteredEventArgs(string regionName, Func getViewDelegate) - { - GetView = getViewDelegate; - RegionName = regionName; - } - - /// - /// Gets the region name to which the content was registered. - /// - public string RegionName { get; private set; } - - /// - /// Gets the content which was registered. - /// - public Func GetView { get; private set; } -} diff --git a/src/Maui/Prism.Maui/Regions/ViewRegistrationException.cs b/src/Maui/Prism.Maui/Regions/ViewRegistrationException.cs deleted file mode 100644 index 5384747c4b..0000000000 --- a/src/Maui/Prism.Maui/Regions/ViewRegistrationException.cs +++ /dev/null @@ -1,53 +0,0 @@ -using System.Runtime.Serialization; - -namespace Prism.Regions; - -/// -/// Exception that's thrown when something goes wrong while Registering a View with a region name in the class. -/// -[Serializable] -public class ViewRegistrationException : Exception -{ - // TODO: Find updated links as these are dead... - // - // For guidelines regarding the creation of new exception types, see - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpgenref/html/cpconerrorraisinghandlingguidelines.asp - // and - // http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncscol/html/csharp07192001.asp - // - - /// - /// Initializes a new instance of the class. - /// - public ViewRegistrationException() - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The exception message. - public ViewRegistrationException(string message) : base(message) - { - } - - /// - /// Initializes a new instance of the class. - /// - /// The exception message. - /// The inner exception. - public ViewRegistrationException(string message, Exception inner) : base(message, inner) - { - } - - /// - /// Initializes a new instance of the class with serialized data. - /// - /// The that holds the serialized - /// object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected ViewRegistrationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } -} \ No newline at end of file diff --git a/src/Maui/Prism.Maui/Regions/ViewSortHintAttribute.cs b/src/Maui/Prism.Maui/Regions/ViewSortHintAttribute.cs deleted file mode 100644 index 74a42cc5bd..0000000000 --- a/src/Maui/Prism.Maui/Regions/ViewSortHintAttribute.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace Prism.Regions; - -/// -/// Provides a hint from a view to a region on how to sort the view. -/// -[AttributeUsage(AttributeTargets.Class, AllowMultiple = false)] -public sealed class ViewSortHintAttribute : Attribute -{ - /// - /// Initializes a new instance of the class. - /// - /// The hint to use for sorting. - public ViewSortHintAttribute(string hint) - { - Hint = hint; - } - - /// - /// Gets the hint. - /// - /// The hint to use for sorting. - public string Hint { get; } -} diff --git a/src/Maui/Prism.Maui/Regions/ViewsCollection.cs b/src/Maui/Prism.Maui/Regions/ViewsCollection.cs index d0e4931e51..e5019eefd6 100644 --- a/src/Maui/Prism.Maui/Regions/ViewsCollection.cs +++ b/src/Maui/Prism.Maui/Regions/ViewsCollection.cs @@ -15,7 +15,7 @@ public class ViewsCollection : BindableBase, IViewsCollection private readonly ObservableCollection _subjectCollection; private readonly Dictionary _monitoredItems = new Dictionary(); - private Comparison _sort; + private Comparison _sort; private List filteredItems = new List(); /// @@ -41,7 +41,7 @@ public ViewsCollection(ObservableCollection list, Predicate /// The comparison to use. - public Comparison SortComparison + public Comparison SortComparison { get => _sort; set => SetProperty(ref _sort, value, () => @@ -61,7 +61,7 @@ public Comparison SortComparison /// /// The object to locate in the collection. /// if is found in the collection; otherwise, . - public bool Contains(VisualElement value) => filteredItems.Contains(value); + public bool Contains(object value) => filteredItems.Contains(value); /// ///Returns an enumerator that iterates through the collection. @@ -69,7 +69,7 @@ public Comparison SortComparison /// ///A that can be used to iterate through the collection. /// - public IEnumerator GetEnumerator() => filteredItems.GetEnumerator(); + public IEnumerator GetEnumerator() => filteredItems.GetEnumerator(); /// ///Returns an enumerator that iterates through a collection. diff --git a/src/Prism.Core/Properties/Resources.Designer.cs b/src/Prism.Core/Properties/Resources.Designer.cs index 73c1c2683b..9746ad9e3f 100644 --- a/src/Prism.Core/Properties/Resources.Designer.cs +++ b/src/Prism.Core/Properties/Resources.Designer.cs @@ -78,6 +78,15 @@ internal static string CannotRegisterSameCommandTwice { } } + /// + /// Looks up a localized string similar to Type '{0}' does not implement from IRegionBehavior.. + /// + internal static string CanOnlyAddTypesThatInheritIFromRegionBehavior { + get { + return ResourceManager.GetString("CanOnlyAddTypesThatInheritIFromRegionBehavior", resourceCulture); + } + } + /// /// Looks up a localized string similar to At least one cyclic dependency has been found in the module catalog. Cycles in the module dependencies must be avoided.. /// @@ -221,6 +230,24 @@ internal static string PropertySupport_StaticExpression_Exception { } } + /// + /// Looks up a localized string similar to The Attach method cannot be called when Region property is null.. + /// + internal static string RegionBehaviorAttachCannotBeCallWithNullRegion { + get { + return ResourceManager.GetString("RegionBehaviorAttachCannotBeCallWithNullRegion", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to The Region property cannot be set after Attach method has been called.. + /// + internal static string RegionBehaviorRegionCannotBeSetAfterAttach { + get { + return ResourceManager.GetString("RegionBehaviorRegionCannotBeSetAfterAttach", resourceCulture); + } + } + /// /// Looks up a localized string similar to Module {0} is marked for automatic initialization when the application starts, but it depends on modules that are marked as OnDemand initialization. To fix this error, mark the dependency modules for InitializationMode=WhenAvailable, or remove this validation by extending the ModuleCatalog class.. /// @@ -238,5 +265,14 @@ internal static string StringCannotBeNullOrEmpty { return ResourceManager.GetString("StringCannotBeNullOrEmpty", resourceCulture); } } + + /// + /// Looks up a localized string similar to No BehaviorType with key '{0}' was registered.. + /// + internal static string TypeWithKeyNotRegistered { + get { + return ResourceManager.GetString("TypeWithKeyNotRegistered", resourceCulture); + } + } } } diff --git a/src/Prism.Core/Properties/Resources.resx b/src/Prism.Core/Properties/Resources.resx index 13680eed5a..fef38b6bab 100644 --- a/src/Prism.Core/Properties/Resources.resx +++ b/src/Prism.Core/Properties/Resources.resx @@ -123,6 +123,9 @@ Cannot register the same command twice in the same CompositeCommand. + + Type '{0}' does not implement from IRegionBehavior. + At least one cyclic dependency has been found in the module catalog. Cycles in the module dependencies must be avoided. @@ -176,10 +179,19 @@ Error was: {1}. The referenced property is a static property. + + The Attach method cannot be called when Region property is null. + + + The Region property cannot be set after Attach method has been called. + Module {0} is marked for automatic initialization when the application starts, but it depends on modules that are marked as OnDemand initialization. To fix this error, mark the dependency modules for InitializationMode=WhenAvailable, or remove this validation by extending the ModuleCatalog class. The provided String argument {0} must not be null or empty. + + No BehaviorType with key '{0}' was registered. + \ No newline at end of file diff --git a/src/Wpf/Prism.Wpf/Regions/IConfirmNavigationRequest.cs b/src/Prism.Core/Regions/IConfirmNavigationRequest.cs similarity index 92% rename from src/Wpf/Prism.Wpf/Regions/IConfirmNavigationRequest.cs rename to src/Prism.Core/Regions/IConfirmNavigationRequest.cs index dd2f6afa0d..5cf3c386e6 100644 --- a/src/Wpf/Prism.Wpf/Regions/IConfirmNavigationRequest.cs +++ b/src/Prism.Core/Regions/IConfirmNavigationRequest.cs @@ -5,7 +5,7 @@ namespace Prism.Regions /// /// Provides a way for objects involved in navigation to determine if a navigation request should continue. /// - public interface IConfirmNavigationRequest : INavigationAware + public interface IConfirmNavigationRequest : IRegionAware { /// /// Determines whether this instance accepts being navigated away from. diff --git a/src/Wpf/Prism.Wpf/Regions/IJournalAware.cs b/src/Prism.Core/Regions/IJournalAware.cs similarity index 100% rename from src/Wpf/Prism.Wpf/Regions/IJournalAware.cs rename to src/Prism.Core/Regions/IJournalAware.cs diff --git a/src/Wpf/Prism.Wpf/Regions/INavigateAsync.cs b/src/Prism.Core/Regions/INavigateAsync.cs similarity index 66% rename from src/Wpf/Prism.Wpf/Regions/INavigateAsync.cs rename to src/Prism.Core/Regions/INavigateAsync.cs index 4d0d89d014..70efdf8f3b 100644 --- a/src/Wpf/Prism.Wpf/Regions/INavigateAsync.cs +++ b/src/Prism.Core/Regions/INavigateAsync.cs @@ -12,17 +12,6 @@ namespace Prism.Regions /// public interface INavigateAsync { - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation target - /// The callback executed when the navigation request is completed. - /// - /// Convenience overloads for this method can be found as extension methods on the - /// class. - /// - void RequestNavigate(Uri target, Action navigationCallback); - /// /// Initiates navigation to the target specified by the . /// diff --git a/src/Wpf/Prism.Wpf/Regions/IRegion.cs b/src/Prism.Core/Regions/IRegion.cs similarity index 92% rename from src/Wpf/Prism.Wpf/Regions/IRegion.cs rename to src/Prism.Core/Regions/IRegion.cs index 9a06685e94..d8b13e7fc6 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegion.cs +++ b/src/Prism.Core/Regions/IRegion.cs @@ -1,14 +1,6 @@ - - using System; using System.ComponentModel; -#if HAS_WINUI -using Microsoft.UI.Xaml; -#else -using System.Windows; -#endif - namespace Prism.Regions { /// @@ -51,7 +43,7 @@ public interface IRegion : INavigateAsync, INotifyPropertyChanged /// Adds a new view to the region. /// /// The view to add. - /// The that is set on the view if it is a . It will be the current region manager when using this overload. + /// The that is set on the view. It will be the current region manager when using this overload. IRegionManager Add(object view); /// @@ -59,7 +51,7 @@ public interface IRegion : INavigateAsync, INotifyPropertyChanged /// /// The view to add. /// The name of the view. This can be used to retrieve it later by calling . - /// The that is set on the view if it is a . It will be the current region manager when using this overload. + /// The that is set on the view. It will be the current region manager when using this overload. IRegionManager Add(object view, string viewName); /// @@ -68,7 +60,7 @@ public interface IRegion : INavigateAsync, INotifyPropertyChanged /// The view to add. /// The name of the view. This can be used to retrieve it later by calling . /// When , the added view will receive a new instance of , otherwise it will use the current region manager for this region. - /// The that is set on the view if it is a . + /// The that is set on the view. IRegionManager Add(object view, string viewName, bool createRegionManagerScope); /// diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionAdapter.cs b/src/Prism.Core/Regions/IRegionAdapter.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/IRegionAdapter.cs rename to src/Prism.Core/Regions/IRegionAdapter.cs index 3b68511a2b..b08c6f266d 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionAdapter.cs +++ b/src/Prism.Core/Regions/IRegionAdapter.cs @@ -1,6 +1,3 @@ - - - namespace Prism.Regions { /// diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionAware.cs b/src/Prism.Core/Regions/IRegionAware.cs similarity index 79% rename from src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionAware.cs rename to src/Prism.Core/Regions/IRegionAware.cs index 89659393e4..dc0a912210 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionAware.cs +++ b/src/Prism.Core/Regions/IRegionAware.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions.Navigation +namespace Prism.Regions { /// /// Provides a way for objects involved in navigation to be notified of navigation activities. @@ -9,7 +9,7 @@ public interface IRegionAware /// Called when the implementer has been navigated to. /// /// The navigation context. - void OnNavigatedTo(INavigationContext navigationContext); + void OnNavigatedTo(NavigationContext navigationContext); /// /// Called to determine if this instance can handle the navigation request. @@ -18,12 +18,12 @@ public interface IRegionAware /// /// if this instance accepts the navigation request; otherwise, . /// - bool IsNavigationTarget(INavigationContext navigationContext); + bool IsNavigationTarget(NavigationContext navigationContext); /// /// Called when the implementer is being navigated away from. /// /// The navigation context. - void OnNavigatedFrom(INavigationContext navigationContext); + void OnNavigatedFrom(NavigationContext navigationContext); } } diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionBehavior.cs b/src/Prism.Core/Regions/IRegionBehavior.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/IRegionBehavior.cs rename to src/Prism.Core/Regions/IRegionBehavior.cs index b35ba49c76..b5113463c5 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionBehavior.cs +++ b/src/Prism.Core/Regions/IRegionBehavior.cs @@ -1,5 +1,3 @@ - - namespace Prism.Regions { /// diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionBehaviorCollection.cs b/src/Prism.Core/Regions/IRegionBehaviorCollection.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/IRegionBehaviorCollection.cs rename to src/Prism.Core/Regions/IRegionBehaviorCollection.cs index e75373357e..02aad070f8 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionBehaviorCollection.cs +++ b/src/Prism.Core/Regions/IRegionBehaviorCollection.cs @@ -1,5 +1,3 @@ - - using System.Collections.Generic; namespace Prism.Regions diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionBehaviorFactory.cs b/src/Prism.Core/Regions/IRegionBehaviorFactory.cs similarity index 89% rename from src/Wpf/Prism.Wpf/Regions/IRegionBehaviorFactory.cs rename to src/Prism.Core/Regions/IRegionBehaviorFactory.cs index 2a0b35e1aa..064d171fa4 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionBehaviorFactory.cs +++ b/src/Prism.Core/Regions/IRegionBehaviorFactory.cs @@ -1,5 +1,3 @@ - - using System; using System.Collections.Generic; @@ -7,9 +5,8 @@ namespace Prism.Regions { /// /// Interface for RegionBehaviorFactories. This factory allows the registration of the default set of RegionBehaviors, that will - /// be added to the s of all s, unless overridden on a 'per-region' basis. + /// be added to the s of all s, unless overridden on a 'per-region' basis. /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "It is more of a factory than a collection")] public interface IRegionBehaviorFactory : IEnumerable { /// diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionBehaviorFactoryExtensions.cs b/src/Prism.Core/Regions/IRegionBehaviorFactoryExtensions.cs similarity index 61% rename from src/Wpf/Prism.Wpf/Regions/IRegionBehaviorFactoryExtensions.cs rename to src/Prism.Core/Regions/IRegionBehaviorFactoryExtensions.cs index 4fdfae878d..d0eb120136 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionBehaviorFactoryExtensions.cs +++ b/src/Prism.Core/Regions/IRegionBehaviorFactoryExtensions.cs @@ -5,6 +5,17 @@ /// public static class IRegionBehaviorFactoryExtensions { + /// + /// Adds a particular type of RegionBehavior if it was not already registered. the Type Name is used to check if the behavior is already present + /// + /// Type of the behavior to add. + /// The IRegionBehaviorFactory instance + public static void AddIfMissing(this IRegionBehaviorFactory regionBehaviorFactory) where T : IRegionBehavior + { + var behaviorType = typeof(T); + regionBehaviorFactory.AddIfMissing(typeof(T).Name, behaviorType); + } + /// /// Adds a particular type of RegionBehavior if it was not already registered. the string is used to check if the behavior is already present /// diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionCollection.cs b/src/Prism.Core/Regions/IRegionCollection.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/IRegionCollection.cs rename to src/Prism.Core/Regions/IRegionCollection.cs index e389752509..a762376d9f 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionCollection.cs +++ b/src/Prism.Core/Regions/IRegionCollection.cs @@ -1,5 +1,3 @@ - - using System; using System.Collections.Generic; using System.Collections.Specialized; diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionManager.cs b/src/Prism.Core/Regions/IRegionManager.cs similarity index 54% rename from src/Wpf/Prism.Wpf/Regions/IRegionManager.cs rename to src/Prism.Core/Regions/IRegionManager.cs index 0d7c0b55a2..40f9287312 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionManager.cs +++ b/src/Prism.Core/Regions/IRegionManager.cs @@ -1,4 +1,5 @@ using System; +using Prism.Ioc; using Prism.Navigation; namespace Prism.Regions @@ -63,37 +64,7 @@ public interface IRegionManager /// The name of the region to associate the view with. /// The delegate used to resolve a concrete instance of the view. /// The , for adding several views easily - IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate); - - /// - /// Navigates the specified region manager. - /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - /// The navigation callback. - void RequestNavigate(string regionName, Uri source, Action navigationCallback); - - /// - /// Navigates the specified region manager. - /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - void RequestNavigate(string regionName, Uri source); - - /// - /// Navigates the specified region manager. - /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - /// The navigation callback. - void RequestNavigate(string regionName, string source, Action navigationCallback); - - /// - /// Navigates the specified region manager. - /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - void RequestNavigate(string regionName, string source); + IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate); /// /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target Uri, passing a navigation callback and an instance of NavigationParameters, which holds a collection of object parameters. @@ -103,30 +74,5 @@ public interface IRegionManager /// The navigation callback that will be executed after the navigation is completed. /// An instance of NavigationParameters, which holds a collection of object parameters. void RequestNavigate(string regionName, Uri target, Action navigationCallback, INavigationParameters navigationParameters); - - /// - /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target string, passing a navigation callback and an instance of NavigationParameters, which holds a collection of object parameters. - /// - /// The name of the region where the navigation will occur. - /// A string that represents the target where the region will navigate. - /// The navigation callback that will be executed after the navigation is completed. - /// An instance of NavigationParameters, which holds a collection of object parameters. - void RequestNavigate(string regionName, string target, Action navigationCallback, INavigationParameters navigationParameters); - - /// - /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target Uri, passing an instance of NavigationParameters, which holds a collection of object parameters. - /// - /// The name of the region where the navigation will occur. - /// A Uri that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - void RequestNavigate(string regionName, Uri target, INavigationParameters navigationParameters); - - /// - /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target string, passing an instance of NavigationParameters, which holds a collection of object parameters. - /// - /// The name of the region where the navigation will occur. - /// A string that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - void RequestNavigate(string regionName, string target, INavigationParameters navigationParameters); } } diff --git a/src/Prism.Core/Regions/IRegionManagerExtensions.cs b/src/Prism.Core/Regions/IRegionManagerExtensions.cs new file mode 100644 index 0000000000..6f70b1e6f1 --- /dev/null +++ b/src/Prism.Core/Regions/IRegionManagerExtensions.cs @@ -0,0 +1,104 @@ +using System; +using Prism.Navigation; + +namespace Prism.Regions +{ + /// + /// Common Extensions for the RegionManager + /// + public static class IRegionManagerExtensions + { + /// + /// Associate a view with a region, using a delegate to resolve a concrete instance of the view. + /// When the region gets displayed, this delegate will be called and the result will be added to the + /// views collection of the region. + /// + /// The current . + /// The name of the region to associate the view with. + /// The delegate used to resolve a concrete instance of the view. + /// The , for adding several views easily + public static IRegionManager RegisterViewWithRegion(this IRegionManager regionManager, string regionName, Func getContentDelegate) => + regionManager.RegisterViewWithRegion(regionName, _ => getContentDelegate()); + + /// + /// Associate a view with a region, by registering a type. When the region get's displayed + /// this type will be resolved using the ServiceLocator into a concrete instance. The instance + /// will be added to the Views collection of the region + /// + /// The type of the view to register with the . + /// The current . + /// The name of the region to associate the view with. + /// The , for adding several views easily + public static IRegionManager RegisterViewWithRegion(this IRegionManager regionManager, string regionName) => + regionManager.RegisterViewWithRegion(regionName, typeof(T)); + + /// + /// Navigates the specified region manager. + /// + /// The current . + /// The name of the region to call Navigate on. + /// The URI of the content to display. + public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri source) => + regionManager.RequestNavigate(regionName, source, _ => { }, new NavigationParameters()); + + /// + /// Navigates the specified region manager. + /// + /// The current . + /// The name of the region to call Navigate on. + /// The URI of the content to display. + /// The navigation callback. + public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri source, Action navigationCallback) => + regionManager.RequestNavigate(regionName, source, navigationCallback, new NavigationParameters()); + + /// + /// Navigates the specified region manager. + /// + /// The current . + /// The name of the region to call Navigate on. + /// The URI of the content to display. + /// The navigation callback. + public static void RequestNavigate(this IRegionManager regionManager, string regionName, string source, Action navigationCallback) => + regionManager.RequestNavigate(regionName, new Uri(source, UriKind.RelativeOrAbsolute), navigationCallback, new NavigationParameters()); + + /// + /// Navigates the specified region manager. + /// + /// The current . + /// The name of the region to call Navigate on. + /// The URI of the content to display. + public static void RequestNavigate(this IRegionManager regionManager, string regionName, string source) => + regionManager.RequestNavigate(regionName, new Uri(source, UriKind.RelativeOrAbsolute), _ => { }, new NavigationParameters()); + + /// + /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target string, passing a navigation callback and an instance of NavigationParameters, which holds a collection of object parameters. + /// + /// The current . + /// The name of the region where the navigation will occur. + /// A string that represents the target where the region will navigate. + /// The navigation callback that will be executed after the navigation is completed. + /// An instance of NavigationParameters, which holds a collection of object parameters. + public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback, INavigationParameters navigationParameters) => + regionManager.RequestNavigate(regionName, new Uri(target, UriKind.RelativeOrAbsolute), navigationCallback, navigationParameters); + + /// + /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target Uri, passing an instance of NavigationParameters, which holds a collection of object parameters. + /// + /// The current . + /// The name of the region where the navigation will occur. + /// A Uri that represents the target where the region will navigate. + /// An instance of NavigationParameters, which holds a collection of object parameters. + public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri target, INavigationParameters navigationParameters) => + regionManager.RequestNavigate(regionName, target, _ => { }, navigationParameters); + + /// + /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target string, passing an instance of NavigationParameters, which holds a collection of object parameters. + /// + /// The current . + /// The name of the region where the navigation will occur. + /// A string that represents the target where the region will navigate. + /// An instance of NavigationParameters, which holds a collection of object parameters. + public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, INavigationParameters navigationParameters) => + regionManager.RequestNavigate(regionName, new Uri(target, UriKind.RelativeOrAbsolute), navigationParameters); + } +} diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionMemberLifetime.cs b/src/Prism.Core/Regions/IRegionMemberLifetime.cs similarity index 81% rename from src/Wpf/Prism.Wpf/Regions/IRegionMemberLifetime.cs rename to src/Prism.Core/Regions/IRegionMemberLifetime.cs index e8d1036c71..b6d8b43149 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionMemberLifetime.cs +++ b/src/Prism.Core/Regions/IRegionMemberLifetime.cs @@ -1,10 +1,8 @@ -using Prism.Regions.Behaviors; - namespace Prism.Regions { /// /// When implemented, allows an instance placed in a - /// that uses a to indicate + /// that uses a RegionMemberLifetimeBehavior to indicate /// it should be removed when it transitions from an activated to deactivated state. /// public interface IRegionMemberLifetime diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionNavigationContentLoader.cs b/src/Prism.Core/Regions/IRegionNavigationContentLoader.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/IRegionNavigationContentLoader.cs rename to src/Prism.Core/Regions/IRegionNavigationContentLoader.cs index a43fb6caf2..6487586c91 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionNavigationContentLoader.cs +++ b/src/Prism.Core/Regions/IRegionNavigationContentLoader.cs @@ -1,5 +1,3 @@ - - using System; namespace Prism.Regions diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationJournal.cs b/src/Prism.Core/Regions/IRegionNavigationJournal.cs similarity index 93% rename from src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationJournal.cs rename to src/Prism.Core/Regions/IRegionNavigationJournal.cs index 84dffdb2ef..32590e0302 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/IRegionNavigationJournal.cs +++ b/src/Prism.Core/Regions/IRegionNavigationJournal.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions.Navigation +namespace Prism.Regions { /// /// Provides journaling of current, back, and forward navigation within regions. @@ -50,7 +50,7 @@ public interface IRegionNavigationJournal /// Records the navigation to the entry.. /// /// The entry to record. - /// true if you it should be persisted in history + /// Keep Navigation object in memory when OnNavigationFrom is called void RecordNavigation(IRegionNavigationJournalEntry entry, bool persistInHistory); /// diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionNavigationJournalEntry.cs b/src/Prism.Core/Regions/IRegionNavigationJournalEntry.cs similarity index 100% rename from src/Wpf/Prism.Wpf/Regions/IRegionNavigationJournalEntry.cs rename to src/Prism.Core/Regions/IRegionNavigationJournalEntry.cs diff --git a/src/Maui/Prism.Maui/Regions/IRegionNavigationRegistry.cs b/src/Prism.Core/Regions/IRegionNavigationRegistry.cs similarity index 100% rename from src/Maui/Prism.Maui/Regions/IRegionNavigationRegistry.cs rename to src/Prism.Core/Regions/IRegionNavigationRegistry.cs diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionNavigationService.cs b/src/Prism.Core/Regions/IRegionNavigationService.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/IRegionNavigationService.cs rename to src/Prism.Core/Regions/IRegionNavigationService.cs index a4776d439d..f402b2207b 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionNavigationService.cs +++ b/src/Prism.Core/Regions/IRegionNavigationService.cs @@ -1,5 +1,3 @@ - - using System; namespace Prism.Regions diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionViewRegistry.cs b/src/Prism.Core/Regions/IRegionViewRegistry.cs similarity index 64% rename from src/Wpf/Prism.Wpf/Regions/IRegionViewRegistry.cs rename to src/Prism.Core/Regions/IRegionViewRegistry.cs index b4c3af4f68..27dca489c1 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionViewRegistry.cs +++ b/src/Prism.Core/Regions/IRegionViewRegistry.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Prism.Ioc; namespace Prism.Regions { @@ -21,8 +22,19 @@ public interface IRegionViewRegistry /// Returns the contents associated with a region name. /// /// Region name for which contents are requested. + /// The to use to resolve the View. /// Collection of contents associated with the . - IEnumerable GetContents(string regionName); + IEnumerable GetContents(string regionName, IContainerProvider container); + + /// + /// Associate a view with a region, by registering a type. When the region get's displayed + /// this type will be resolved using the ServiceLocator into a concrete instance. The instance + /// will be added to the Views collection of the region + /// + /// The name of the region to associate the view with. + /// The type of the view to register with the + /// The , for adding several views easily + void RegisterViewWithRegion(string regionName, string targetName); /// /// Registers a content type with a region name. @@ -36,6 +48,6 @@ public interface IRegionViewRegistry /// /// Region name to which the will be registered. /// Delegate used to retrieve the content associated with the . - void RegisterViewWithRegion(string regionName, Func getContentDelegate); + public void RegisterViewWithRegion(string regionName, Func getContentDelegate); } } diff --git a/src/Wpf/Prism.Wpf/Regions/IViewsCollection.cs b/src/Prism.Core/Regions/IViewsCollection.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/IViewsCollection.cs rename to src/Prism.Core/Regions/IViewsCollection.cs index 0dc39138d0..dea55f3b4c 100644 --- a/src/Wpf/Prism.Wpf/Regions/IViewsCollection.cs +++ b/src/Prism.Core/Regions/IViewsCollection.cs @@ -1,5 +1,3 @@ - - using System.Collections.Generic; using System.Collections.Specialized; diff --git a/src/Wpf/Prism.Wpf/Regions/NavigationAsyncExtensions.cs b/src/Prism.Core/Regions/NavigationAsyncExtensions.cs similarity index 85% rename from src/Wpf/Prism.Wpf/Regions/NavigationAsyncExtensions.cs rename to src/Prism.Core/Regions/NavigationAsyncExtensions.cs index e4d13a40b5..4a3bac62ef 100644 --- a/src/Wpf/Prism.Wpf/Regions/NavigationAsyncExtensions.cs +++ b/src/Prism.Core/Regions/NavigationAsyncExtensions.cs @@ -8,6 +8,19 @@ namespace Prism.Regions /// public static class NavigationAsyncExtensions { + /// + /// Initiates navigation to the target specified by the . + /// + /// The navigation object. + /// The navigation target + /// The callback executed when the navigation request is completed. + /// + /// Convenience overloads for this method can be found as extension methods on the + /// class. + /// + public static void RequestNavigate(this INavigateAsync navigation, Uri target, Action navigationCallback) => + navigation.RequestNavigate(target, navigationCallback, new NavigationParameters()); + /// /// Initiates navigation to the target specified by the . /// diff --git a/src/Wpf/Prism.Wpf/Regions/NavigationContext.cs b/src/Prism.Core/Regions/NavigationContext.cs similarity index 100% rename from src/Wpf/Prism.Wpf/Regions/NavigationContext.cs rename to src/Prism.Core/Regions/NavigationContext.cs diff --git a/src/Prism.Core/Regions/NavigationContextExtensions.cs b/src/Prism.Core/Regions/NavigationContextExtensions.cs new file mode 100644 index 0000000000..2d08307ce4 --- /dev/null +++ b/src/Prism.Core/Regions/NavigationContextExtensions.cs @@ -0,0 +1,23 @@ +using Prism.Common; + +namespace Prism.Regions +{ + /// + /// Provides extensions for the Navigation Context + /// + public static class NavigationContextExtensions + { + /// + /// Gets the Navigation Segment name from the . + /// + /// The current instance of the . + /// The View Name that was navigated to. + public static string NavigatedName(this NavigationContext context) + { + var uri = UriParsingHelper.EnsureAbsolute(context.Uri); + var segments = UriParsingHelper.GetUriSegments(uri); + var segment = segments.Dequeue(); + return UriParsingHelper.GetSegmentName(segment); + } + } +} diff --git a/src/Wpf/Prism.Wpf/Regions/NavigationResult.cs b/src/Prism.Core/Regions/NavigationResult.cs similarity index 89% rename from src/Wpf/Prism.Wpf/Regions/NavigationResult.cs rename to src/Prism.Core/Regions/NavigationResult.cs index ea912086da..82bc6ed764 100644 --- a/src/Wpf/Prism.Wpf/Regions/NavigationResult.cs +++ b/src/Prism.Core/Regions/NavigationResult.cs @@ -1,5 +1,3 @@ - - using System; namespace Prism.Regions @@ -16,8 +14,8 @@ public class NavigationResult /// The result. public NavigationResult(NavigationContext context, bool? result) { - this.Context = context; - this.Result = result; + Context = context; + Result = result; } /// @@ -27,9 +25,9 @@ public NavigationResult(NavigationContext context, bool? result) /// The error. public NavigationResult(NavigationContext context, Exception error) { - this.Context = context; - this.Error = error; - this.Result = false; + Context = context; + Error = error; + Result = false; } /// diff --git a/src/Wpf/Prism.Wpf/Regions/RegionBehavior.cs b/src/Prism.Core/Regions/RegionBehavior.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/RegionBehavior.cs rename to src/Prism.Core/Regions/RegionBehavior.cs index 31da5a666a..85a184b14d 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionBehavior.cs +++ b/src/Prism.Core/Regions/RegionBehavior.cs @@ -1,5 +1,3 @@ - - using System; using Prism.Properties; diff --git a/src/Wpf/Prism.Wpf/Regions/RegionBehaviorCollection.cs b/src/Prism.Core/Regions/RegionBehaviorCollection.cs similarity index 84% rename from src/Wpf/Prism.Wpf/Regions/RegionBehaviorCollection.cs rename to src/Prism.Core/Regions/RegionBehaviorCollection.cs index a31c9458e7..0b5c089bc0 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionBehaviorCollection.cs +++ b/src/Prism.Core/Regions/RegionBehaviorCollection.cs @@ -1,5 +1,3 @@ - - using System; using System.Collections; using System.Collections.Generic; @@ -27,10 +25,7 @@ public RegionBehaviorCollection(IRegion region) /// Gets the with the specified key. /// /// The RegionBehavior that's registered with the key. - public IRegionBehavior this[string key] - { - get { return this.behaviors[key]; } - } + public IRegionBehavior this[string key] => behaviors[key]; /// /// Adds a to the collection, using the specified key as an indexer. @@ -50,11 +45,11 @@ public void Add(string key, IRegionBehavior regionBehavior) if (regionBehavior == null) throw new ArgumentNullException(nameof(regionBehavior)); - if (this.behaviors.ContainsKey(key)) + if (behaviors.ContainsKey(key)) throw new ArgumentException("Could not add duplicate behavior with same key.", nameof(key)); - this.behaviors.Add(key, regionBehavior); - regionBehavior.Region = this.region; + behaviors.Add(key, regionBehavior); + regionBehavior.Region = region; regionBehavior.Attach(); } @@ -64,10 +59,7 @@ public void Add(string key, IRegionBehavior regionBehavior) /// /// The key to use to find a particular . /// - public bool ContainsKey(string key) - { - return this.behaviors.ContainsKey(key); - } + public bool ContainsKey(string key) => behaviors.ContainsKey(key); /// /// Returns an enumerator that iterates through the collection. @@ -75,10 +67,7 @@ public bool ContainsKey(string key) /// /// A that can be used to iterate through the collection. /// - public IEnumerator> GetEnumerator() - { - return behaviors.GetEnumerator(); - } + public IEnumerator> GetEnumerator() => behaviors.GetEnumerator(); /// /// Returns an enumerator that iterates through a collection. @@ -86,9 +75,6 @@ public IEnumerator> GetEnumerator() /// /// An object that can be used to iterate through the collection. /// - IEnumerator IEnumerable.GetEnumerator() - { - return behaviors.GetEnumerator(); - } + IEnumerator IEnumerable.GetEnumerator() => behaviors.GetEnumerator(); } } diff --git a/src/Wpf/Prism.Wpf/Regions/RegionBehaviorFactory.cs b/src/Prism.Core/Regions/RegionBehaviorFactory.cs similarity index 96% rename from src/Wpf/Prism.Wpf/Regions/RegionBehaviorFactory.cs rename to src/Prism.Core/Regions/RegionBehaviorFactory.cs index 847e23a259..8caaa17f95 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionBehaviorFactory.cs +++ b/src/Prism.Core/Regions/RegionBehaviorFactory.cs @@ -11,7 +11,6 @@ namespace Prism.Regions /// Defines a factory that allows the registration of the default set of , that will /// be added to the of all s, unless overridden on a 'per-region' basis. /// - [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1710:IdentifiersShouldHaveCorrectSuffix", Justification = "It is more of a factory than a collection")] public class RegionBehaviorFactory : IRegionBehaviorFactory { private readonly IContainerProvider _container; diff --git a/src/Prism.Core/Regions/RegionCreationException.cs b/src/Prism.Core/Regions/RegionCreationException.cs new file mode 100644 index 0000000000..5e7d62a9bc --- /dev/null +++ b/src/Prism.Core/Regions/RegionCreationException.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Runtime.Serialization; +using System.Text; + +namespace Prism.Regions; + +/// +/// An exception used when encountering an error in the creation of a Region +/// +[Serializable] +public sealed class RegionCreationException : RegionException +{ + /// + public RegionCreationException() + { + } + + /// + public RegionCreationException(string message) : base(message) + { + } + + /// + public RegionCreationException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + + /// + public RegionCreationException(string message, Exception innerException) : base(message, innerException) + { + } +} diff --git a/src/Prism.Core/Regions/RegionException.cs b/src/Prism.Core/Regions/RegionException.cs new file mode 100644 index 0000000000..e2103f093f --- /dev/null +++ b/src/Prism.Core/Regions/RegionException.cs @@ -0,0 +1,30 @@ +using System; +using System.Runtime.Serialization; + +namespace Prism.Regions; + +/// +/// Provides a common base class for Region Exceptions +/// +public abstract class RegionException : Exception +{ + /// + protected RegionException() + { + } + + /// + protected RegionException(string message) : base(message) + { + } + + /// + protected RegionException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + + /// + protected RegionException(string message, Exception innerException) : base(message, innerException) + { + } +} diff --git a/src/Wpf/Prism.Wpf/Regions/RegionMemberLifetimeAttribute.cs b/src/Prism.Core/Regions/RegionMemberLifetimeAttribute.cs similarity index 86% rename from src/Wpf/Prism.Wpf/Regions/RegionMemberLifetimeAttribute.cs rename to src/Prism.Core/Regions/RegionMemberLifetimeAttribute.cs index d19544d624..fa8feabe48 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionMemberLifetimeAttribute.cs +++ b/src/Prism.Core/Regions/RegionMemberLifetimeAttribute.cs @@ -1,13 +1,10 @@ - - using System; -using Prism.Regions.Behaviors; namespace Prism.Regions { /// /// When is applied to class provides data - /// the can use to determine if the instance should + /// the RegionMemberLifetimeBehavior can use to determine if the instance should /// be removed when it is deactivated. /// [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface, AllowMultiple = true, Inherited = true)] diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationEventArgs.cs b/src/Prism.Core/Regions/RegionNavigationEventArgs.cs similarity index 78% rename from src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationEventArgs.cs rename to src/Prism.Core/Regions/RegionNavigationEventArgs.cs index 41754689e9..34b57ff0f0 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationEventArgs.cs +++ b/src/Prism.Core/Regions/RegionNavigationEventArgs.cs @@ -1,6 +1,6 @@ -using System; +using System; -namespace Prism.Regions.Navigation +namespace Prism.Regions { /// /// EventArgs used with the Navigated event. @@ -11,7 +11,7 @@ public class RegionNavigationEventArgs : EventArgs /// Initializes a new instance of the class. /// /// The navigation context. - public RegionNavigationEventArgs(INavigationContext navigationContext) + public RegionNavigationEventArgs(NavigationContext navigationContext) { NavigationContext = navigationContext ?? throw new ArgumentNullException(nameof(navigationContext)); } @@ -20,7 +20,7 @@ public RegionNavigationEventArgs(INavigationContext navigationContext) /// Gets the navigation context. /// /// The navigation context. - public INavigationContext NavigationContext { get; } + public NavigationContext NavigationContext { get; } /// /// Gets the navigation URI @@ -29,6 +29,6 @@ public RegionNavigationEventArgs(INavigationContext navigationContext) /// /// This is a convenience accessor around NavigationContext.Uri. /// - public Uri Uri => NavigationContext?.Uri; + public Uri Uri => NavigationContext.Uri; } } diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationFailedEventArgs.cs b/src/Prism.Core/Regions/RegionNavigationFailedEventArgs.cs similarity index 80% rename from src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationFailedEventArgs.cs rename to src/Prism.Core/Regions/RegionNavigationFailedEventArgs.cs index 09bfa25ae6..22117cf9ee 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationFailedEventArgs.cs +++ b/src/Prism.Core/Regions/RegionNavigationFailedEventArgs.cs @@ -1,6 +1,6 @@ -using System; +using System; -namespace Prism.Regions.Navigation +namespace Prism.Regions { /// /// EventArgs used with the NavigationFailed event. @@ -11,7 +11,7 @@ public class RegionNavigationFailedEventArgs : EventArgs /// Initializes a new instance of the class. /// /// The navigation context. - public RegionNavigationFailedEventArgs(INavigationContext navigationContext) + public RegionNavigationFailedEventArgs(NavigationContext navigationContext) { NavigationContext = navigationContext ?? throw new ArgumentNullException(nameof(navigationContext)); } @@ -21,7 +21,7 @@ public RegionNavigationFailedEventArgs(INavigationContext navigationContext) /// /// The navigation context. /// The error. - public RegionNavigationFailedEventArgs(INavigationContext navigationContext, Exception error) + public RegionNavigationFailedEventArgs(NavigationContext navigationContext, Exception error) : this(navigationContext) { Error = error; @@ -31,7 +31,7 @@ public RegionNavigationFailedEventArgs(INavigationContext navigationContext, Exc /// Gets the navigation context. /// /// The navigation context. - public INavigationContext NavigationContext { get; } + public NavigationContext NavigationContext { get; } /// /// Gets the error. @@ -46,6 +46,6 @@ public RegionNavigationFailedEventArgs(INavigationContext navigationContext, Exc /// /// This is a convenience accessor around NavigationContext.Uri. /// - public Uri Uri => NavigationContext?.Uri; + public Uri Uri => NavigationContext.Uri; } } diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationJournal.cs b/src/Prism.Core/Regions/RegionNavigationJournal.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/RegionNavigationJournal.cs rename to src/Prism.Core/Regions/RegionNavigationJournal.cs index 4d84963682..75ec8dcd21 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionNavigationJournal.cs +++ b/src/Prism.Core/Regions/RegionNavigationJournal.cs @@ -1,5 +1,3 @@ - - using System; using System.Collections.Generic; diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationJournalEntry.cs b/src/Prism.Core/Regions/RegionNavigationJournalEntry.cs similarity index 100% rename from src/Wpf/Prism.Wpf/Regions/RegionNavigationJournalEntry.cs rename to src/Prism.Core/Regions/RegionNavigationJournalEntry.cs diff --git a/src/Prism.Core/Regions/RegionViewRegistryExtensions.cs b/src/Prism.Core/Regions/RegionViewRegistryExtensions.cs new file mode 100644 index 0000000000..a4e3188d43 --- /dev/null +++ b/src/Prism.Core/Regions/RegionViewRegistryExtensions.cs @@ -0,0 +1,30 @@ +using System; +using System.Collections.Generic; +using Prism.Ioc; + +namespace Prism.Regions +{ + /// + /// Provides extensions for the . + /// + public static class RegionViewRegistryExtensions + { + /// + /// Registers a delegate that can be used to retrieve the content associated with a region name. + /// + /// The instance. + /// Region name to which the will be registered. + /// Delegate used to retrieve the content associated with the . + public static void RegisterViewWithRegion(this IRegionViewRegistry viewRegistry, string regionName, Func getContentDelegate) => + viewRegistry.RegisterViewWithRegion(regionName, _ => getContentDelegate()); + + /// + /// Returns the contents associated with a region name. + /// + /// The current instance. + /// Region name for which contents are requested. + /// Collection of contents associated with the . + public static IEnumerable GetContents(this IRegionViewRegistry viewRegistry, string regionName) => + viewRegistry.GetContents(regionName, ContainerLocator.Container); + } +} diff --git a/src/Wpf/Prism.Wpf/Regions/SyncActiveStateAttribute.cs b/src/Prism.Core/Regions/SyncActiveStateAttribute.cs similarity index 100% rename from src/Wpf/Prism.Wpf/Regions/SyncActiveStateAttribute.cs rename to src/Prism.Core/Regions/SyncActiveStateAttribute.cs diff --git a/src/Wpf/Prism.Wpf/Regions/UpdateRegionsException.cs b/src/Prism.Core/Regions/UpdateRegionsException.cs similarity index 65% rename from src/Wpf/Prism.Wpf/Regions/UpdateRegionsException.cs rename to src/Prism.Core/Regions/UpdateRegionsException.cs index 267c451608..23ebe578e1 100644 --- a/src/Wpf/Prism.Wpf/Regions/UpdateRegionsException.cs +++ b/src/Prism.Core/Regions/UpdateRegionsException.cs @@ -1,10 +1,12 @@ using System; +using System.Runtime.Serialization; namespace Prism.Regions { /// - /// Represents errors that occured during the regions' update. + /// Represents errors that occurred during the regions' update. /// + [Serializable] public partial class UpdateRegionsException : Exception { /// @@ -34,5 +36,15 @@ public UpdateRegionsException(string message, Exception inner) : base(message, inner) { } + + /// + /// Initializes a new instance of the class with serialized data. + /// + /// The that holds the serialized object data about the exception being thrown. + /// The that contains contextual information about the source or destination. + protected UpdateRegionsException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } } diff --git a/src/Wpf/Prism.Wpf/Regions/ViewRegisteredEventArgs.cs b/src/Prism.Core/Regions/ViewRegisteredEventArgs.cs similarity index 82% rename from src/Wpf/Prism.Wpf/Regions/ViewRegisteredEventArgs.cs rename to src/Prism.Core/Regions/ViewRegisteredEventArgs.cs index a2d71010e3..1b25eb5cd4 100644 --- a/src/Wpf/Prism.Wpf/Regions/ViewRegisteredEventArgs.cs +++ b/src/Prism.Core/Regions/ViewRegisteredEventArgs.cs @@ -1,6 +1,5 @@ - - using System; +using Prism.Ioc; namespace Prism.Regions { @@ -14,7 +13,7 @@ public class ViewRegisteredEventArgs : EventArgs /// /// The region name to which the content was registered. /// The content which was registered. - public ViewRegisteredEventArgs(string regionName, Func getViewDelegate) + public ViewRegisteredEventArgs(string regionName, Func getViewDelegate) { this.GetView = getViewDelegate; this.RegionName = regionName; @@ -28,6 +27,6 @@ public ViewRegisteredEventArgs(string regionName, Func getViewDelegate) /// /// Gets the content which was registered. /// - public Func GetView { get; private set; } + public Func GetView { get; private set; } } } diff --git a/src/Wpf/Prism.Wpf/Regions/ViewRegistrationException.cs b/src/Prism.Core/Regions/ViewRegistrationException.cs similarity index 70% rename from src/Wpf/Prism.Wpf/Regions/ViewRegistrationException.cs rename to src/Prism.Core/Regions/ViewRegistrationException.cs index a5b0784387..b242cd90d4 100644 --- a/src/Wpf/Prism.Wpf/Regions/ViewRegistrationException.cs +++ b/src/Prism.Core/Regions/ViewRegistrationException.cs @@ -1,10 +1,12 @@ using System; +using System.Runtime.Serialization; namespace Prism.Regions { /// /// Exception that's thrown when something goes wrong while Registering a View with a region name in the class. /// + [Serializable] public partial class ViewRegistrationException : Exception { // TODO: Find updated links as these are dead... @@ -39,6 +41,15 @@ public ViewRegistrationException(string message, Exception inner) : base(message { } - + /// + /// Initializes a new instance of the class with serialized data. + /// + /// The that holds the serialized + /// object data about the exception being thrown. + /// The that contains contextual information about the source or destination. + protected ViewRegistrationException(SerializationInfo info, StreamingContext context) + : base(info, context) + { + } } } diff --git a/src/Wpf/Prism.Wpf/Regions/ViewSortHintAttribute.cs b/src/Prism.Core/Regions/ViewSortHintAttribute.cs similarity index 100% rename from src/Wpf/Prism.Wpf/Regions/ViewSortHintAttribute.cs rename to src/Prism.Core/Regions/ViewSortHintAttribute.cs diff --git a/src/Wpf/Prism.Wpf/Properties/Resources.resx b/src/Wpf/Prism.Wpf/Properties/Resources.resx index 0cd2cda19f..8158812ee1 100644 --- a/src/Wpf/Prism.Wpf/Properties/Resources.resx +++ b/src/Wpf/Prism.Wpf/Properties/Resources.resx @@ -126,9 +126,6 @@ Cannot create navigation target '{0}'. - - Type '{0}' does not implement from IRegionBehavior. - The ConfigurationStore cannot contain a null value. @@ -221,12 +218,6 @@ The referenced property is a static property. - - The Attach method cannot be called when Region property is null. - - - The Region property cannot be set after Attach method has been called. - An exception occurred while creating a region with name '{0}'. The exception was: {1}. @@ -257,9 +248,6 @@ The provided String argument {0} must not be null or empty. - - No BehaviorType with key '{0}' was registered. - An exception occurred while trying to create region objects. - The most likely causing exception was: '{0}'. diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/AutoPopulateRegionBehavior.cs b/src/Wpf/Prism.Wpf/Regions/Behaviors/AutoPopulateRegionBehavior.cs index f323633921..3bee518451 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/AutoPopulateRegionBehavior.cs +++ b/src/Wpf/Prism.Wpf/Regions/Behaviors/AutoPopulateRegionBehavior.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using Prism.Ioc; namespace Prism.Regions.Behaviors { @@ -92,7 +93,7 @@ public virtual void OnViewRegistered(object sender, ViewRegisteredEventArgs e) if (e.RegionName == this.Region.Name) { - AddViewIntoRegion(e.GetView()); + AddViewIntoRegion(e.GetView(ContainerLocator.Container)); } } } diff --git a/src/Wpf/Prism.Wpf/Regions/INavigationAware.cs b/src/Wpf/Prism.Wpf/Regions/INavigationAware.cs index 9592370372..78046d6329 100644 --- a/src/Wpf/Prism.Wpf/Regions/INavigationAware.cs +++ b/src/Wpf/Prism.Wpf/Regions/INavigationAware.cs @@ -1,32 +1,15 @@ - - +#if !HAS_UNO_WINUI && !HAS_WINUI namespace Prism.Regions { /// /// Provides a way for objects involved in navigation to be notified of navigation activities. /// - public interface INavigationAware + /// + /// Provides compatibility for Legacy Prism.Wpf apps. + /// + public interface INavigationAware : IRegionAware { - /// - /// Called when the implementer has been navigated to. - /// - /// The navigation context. - void OnNavigatedTo(NavigationContext navigationContext); - - /// - /// Called to determine if this instance can handle the navigation request. - /// - /// The navigation context. - /// - /// if this instance accepts the navigation request; otherwise, . - /// - bool IsNavigationTarget(NavigationContext navigationContext); - - /// - /// Called when the implementer is being navigated away from. - /// - /// The navigation context. - void OnNavigatedFrom(NavigationContext navigationContext); } } +#endif diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionManagerAccessor.cs b/src/Wpf/Prism.Wpf/Regions/IRegionManagerAccessor.cs index fff02c4805..3de10e4139 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionManagerAccessor.cs +++ b/src/Wpf/Prism.Wpf/Regions/IRegionManagerAccessor.cs @@ -1,5 +1,3 @@ - - using System; #if HAS_WINUI diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionManagerExtensions.cs b/src/Wpf/Prism.Wpf/Regions/IRegionManagerExtensions.cs deleted file mode 100644 index 4ca2821479..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/IRegionManagerExtensions.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace Prism.Regions -{ - /// - /// Common Extensions for the RegionManager - /// - public static class IRegionManagerExtensions - { - /// - /// Associate a view with a region, by registering a type. When the region get's displayed - /// this type will be resolved using the ServiceLocator into a concrete instance. The instance - /// will be added to the Views collection of the region - /// - /// The type of the view to register with the . - /// The current . - /// The name of the region to associate the view with. - /// The , for adding several views easily - public static IRegionManager RegisterViewWithRegion(this IRegionManager regionManager, string regionName) => - regionManager.RegisterViewWithRegion(regionName, typeof(T)); - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionNavigationJournal.cs b/src/Wpf/Prism.Wpf/Regions/IRegionNavigationJournal.cs deleted file mode 100644 index d77f119523..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/IRegionNavigationJournal.cs +++ /dev/null @@ -1,72 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -#if HAS_WINUI -using Microsoft.UI.Xaml; -#else -using System.Windows; -#endif - -namespace Prism.Regions -{ - /// - /// Provides journaling of current, back, and forward navigation within regions. - /// - public interface IRegionNavigationJournal - { - /// - /// Gets a value that indicates whether there is at least one entry in the back navigation history. - /// - /// - /// true if the journal can go back; otherwise, false. - /// - bool CanGoBack { get; } - - /// - /// Gets a value that indicates whether there is at least one entry in the forward navigation history. - /// - /// - /// true if this instance can go forward; otherwise, false. - /// - bool CanGoForward { get; } - - /// - /// Gets the current navigation entry of the content that is currently displayed. - /// - /// The current entry. - IRegionNavigationJournalEntry CurrentEntry { get; } - - /// - /// Gets or sets the target that implements INavigateAsync. - /// - /// The INavigate implementation. - /// - /// This is set by the owner of this journal. - /// - INavigateAsync NavigationTarget { get; set; } - - /// - /// Navigates to the most recent entry in the back navigation history, or does nothing if no entry exists in back navigation. - /// - void GoBack(); - - /// - /// Navigates to the most recent entry in the forward navigation history, or does nothing if no entry exists in forward navigation. - /// - void GoForward(); - - /// - /// Records the navigation to the entry.. - /// - /// The entry to record. - /// Keep Navigation object in memory when OnNavigationFrom is called - void RecordNavigation(IRegionNavigationJournalEntry entry, bool persistInHistory); - - /// - /// Clears the journal of current, back, and forward navigation histories. - /// - void Clear(); - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs b/src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs index ec02a6ec46..e204066b71 100644 --- a/src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs +++ b/src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs @@ -1,5 +1,3 @@ - - using System; #if HAS_WINUI @@ -19,13 +17,13 @@ public partial class ItemMetadata : DependencyObject /// The name of the wrapped item. /// public static readonly DependencyProperty NameProperty = - DependencyProperty.Register("Name", typeof(string), typeof(ItemMetadata), null); + DependencyProperty.Register(nameof(Name), typeof(string), typeof(ItemMetadata), null); /// /// Value indicating whether the wrapped item is considered active. /// public static readonly DependencyProperty IsActiveProperty = - DependencyProperty.Register("IsActive", typeof(bool), typeof(ItemMetadata), new PropertyMetadata(defaultValue: false, propertyChangedCallback: DependencyPropertyChanged)); + DependencyProperty.Register(nameof(IsActive), typeof(bool), typeof(ItemMetadata), new PropertyMetadata(defaultValue: false, propertyChangedCallback: DependencyPropertyChanged)); /// /// Initializes a new instance of . @@ -34,7 +32,7 @@ public partial class ItemMetadata : DependencyObject public ItemMetadata(object item) { // check for null - this.Item = item; + Item = item; } /// @@ -49,8 +47,8 @@ public ItemMetadata(object item) /// The name of the wrapped item. public string Name { - get { return (string)GetValue(NameProperty); } - set { SetValue(NameProperty, value); } + get => (string)GetValue(NameProperty); + set => SetValue(NameProperty, value); } /// @@ -59,8 +57,8 @@ public string Name /// if the item should be considered active; otherwise . public bool IsActive { - get { return (bool)GetValue(IsActiveProperty); } - set { SetValue(IsActiveProperty, value); } + get => (bool)GetValue(IsActiveProperty); + set => SetValue(IsActiveProperty, value); } /// diff --git a/src/Wpf/Prism.Wpf/Regions/RegionManager.cs b/src/Wpf/Prism.Wpf/Regions/RegionManager.cs index 50c6829019..4345223f0c 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionManager.cs +++ b/src/Wpf/Prism.Wpf/Regions/RegionManager.cs @@ -347,7 +347,7 @@ public IRegionManager RegisterViewWithRegion(string regionName, string targetNam /// The name of the region to associate the view with. /// The delegate used to resolve a concrete instance of the view. /// The , for adding several views easily - public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) + public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) { var regionViewRegistry = ContainerLocator.Container.Resolve(); @@ -377,40 +377,6 @@ public void RequestNavigate(string regionName, Uri source, Action - /// Navigates the specified region manager. - /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - public void RequestNavigate(string regionName, Uri source) - { - RequestNavigate(regionName, source, nr => { }); - } - - /// - /// Navigates the specified region manager. - /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - /// The navigation callback. - public void RequestNavigate(string regionName, string source, Action navigationCallback) - { - if (source == null) - throw new ArgumentNullException(nameof(source)); - - RequestNavigate(regionName, new Uri(source, UriKind.RelativeOrAbsolute), navigationCallback); - } - - /// - /// Navigates the specified region manager. - /// - /// The name of the region to call Navigate on. - /// The URI of the content to display. - public void RequestNavigate(string regionName, string source) - { - RequestNavigate(regionName, source, nr => { }); - } - /// /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target Uri, passing a navigation callback and an instance of NavigationParameters, which holds a collection of object parameters. /// @@ -433,40 +399,6 @@ public void RequestNavigate(string regionName, Uri target, Action - /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target string, passing a navigation callback and an instance of NavigationParameters, which holds a collection of object parameters. - /// - /// The name of the region where the navigation will occur. - /// A string that represents the target where the region will navigate. - /// The navigation callback that will be executed after the navigation is completed. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public void RequestNavigate(string regionName, string target, Action navigationCallback, INavigationParameters navigationParameters) - { - RequestNavigate(regionName, new Uri(target, UriKind.RelativeOrAbsolute), navigationCallback, navigationParameters); - } - - /// - /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target Uri, passing an instance of NavigationParameters, which holds a collection of object parameters. - /// - /// The name of the region where the navigation will occur. - /// A Uri that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public void RequestNavigate(string regionName, Uri target, INavigationParameters navigationParameters) - { - RequestNavigate(regionName, target, nr => { }, navigationParameters); - } - - /// - /// This method allows an IRegionManager to locate a specified region and navigate in it to the specified target string, passing an instance of NavigationParameters, which holds a collection of object parameters. - /// - /// The name of the region where the navigation will occur. - /// A string that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public void RequestNavigate(string regionName, string target, INavigationParameters navigationParameters) - { - RequestNavigate(regionName, new Uri(target, UriKind.RelativeOrAbsolute), nr => { }, navigationParameters); - } - /// /// Provides a new item for the region based on the supplied candidate target contract name. /// diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationContentLoader.cs b/src/Wpf/Prism.Wpf/Regions/RegionNavigationContentLoader.cs index af4be1ebae..bad6a6763f 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionNavigationContentLoader.cs +++ b/src/Wpf/Prism.Wpf/Regions/RegionNavigationContentLoader.cs @@ -62,7 +62,7 @@ public object LoadContent(IRegion region, NavigationContext navigationContext) candidates.Where( v => { - if (v is INavigationAware navigationAware && !navigationAware.IsNavigationTarget(navigationContext)) + if (v is IRegionAware navigationAware && !navigationAware.IsNavigationTarget(navigationContext)) { return false; } @@ -72,7 +72,7 @@ public object LoadContent(IRegion region, NavigationContext navigationContext) return true; } - navigationAware = frameworkElement.DataContext as INavigationAware; + navigationAware = frameworkElement.DataContext as IRegionAware; return navigationAware == null || navigationAware.IsNavigationTarget(navigationContext); }); diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationEventArgs.cs b/src/Wpf/Prism.Wpf/Regions/RegionNavigationEventArgs.cs deleted file mode 100644 index 46fa72091f..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/RegionNavigationEventArgs.cs +++ /dev/null @@ -1,50 +0,0 @@ - - -using System; - -namespace Prism.Regions -{ - /// - /// EventArgs used with the Navigated event. - /// - public class RegionNavigationEventArgs : EventArgs - { - /// - /// Initializes a new instance of the class. - /// - /// The navigation context. - public RegionNavigationEventArgs(NavigationContext navigationContext) - { - if (navigationContext == null) - throw new ArgumentNullException(nameof(navigationContext)); - - this.NavigationContext = navigationContext; - } - - /// - /// Gets the navigation context. - /// - /// The navigation context. - public NavigationContext NavigationContext { get; private set; } - - /// - /// Gets the navigation URI - /// - /// The URI. - /// - /// This is a convenience accessor around NavigationContext.Uri. - /// - public Uri Uri - { - get - { - if (this.NavigationContext != null) - { - return this.NavigationContext.Uri; - } - - return null; - } - } - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationFailedEventArgs.cs b/src/Wpf/Prism.Wpf/Regions/RegionNavigationFailedEventArgs.cs deleted file mode 100644 index 62ac000ac4..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/RegionNavigationFailedEventArgs.cs +++ /dev/null @@ -1,67 +0,0 @@ - - -using System; - -namespace Prism.Regions -{ - /// - /// EventArgs used with the NavigationFailed event. - /// - public class RegionNavigationFailedEventArgs : EventArgs - { - /// - /// Initializes a new instance of the class. - /// - /// The navigation context. - public RegionNavigationFailedEventArgs(NavigationContext navigationContext) - { - if (navigationContext == null) - throw new ArgumentNullException(nameof(navigationContext)); - - this.NavigationContext = navigationContext; - } - - /// - /// Initializes a new instance of the class. - /// - /// The navigation context. - /// The error. - public RegionNavigationFailedEventArgs(NavigationContext navigationContext, Exception error) - : this(navigationContext) - { - this.Error = error; - } - - /// - /// Gets the navigation context. - /// - /// The navigation context. - public NavigationContext NavigationContext { get; private set; } - - /// - /// Gets the error. - /// - /// The , or if the failure was not caused by an exception. - public Exception Error { get; private set; } - - /// - /// Gets the navigation URI - /// - /// The URI. - /// - /// This is a convenience accessor around NavigationContext.Uri. - /// - public Uri Uri - { - get - { - if (this.NavigationContext != null) - { - return this.NavigationContext.Uri; - } - - return null; - } - } - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationService.cs b/src/Wpf/Prism.Wpf/Regions/RegionNavigationService.cs index a1a2af43b1..da5b8b11cf 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionNavigationService.cs +++ b/src/Wpf/Prism.Wpf/Regions/RegionNavigationService.cs @@ -240,7 +240,7 @@ private void ExecuteNavigation(NavigationContext navigationContext, object[] act Journal.RecordNavigation(journalEntry, persistInHistory); // The view can be informed of navigation - Action action = (n) => n.OnNavigatedTo(navigationContext); + Action action = (n) => n.OnNavigatedTo(navigationContext); MvvmHelpers.ViewAndViewModelAction(view, action); navigationCallback(new NavigationResult(navigationContext, true)); @@ -275,7 +275,7 @@ private static void NotifyActiveViewsNavigatingFrom(NavigationContext navigation InvokeOnNavigationAwareElements(activeViews, (n) => n.OnNavigatedFrom(navigationContext)); } - private static void InvokeOnNavigationAwareElements(IEnumerable items, Action invocation) + private static void InvokeOnNavigationAwareElements(IEnumerable items, Action invocation) { foreach (var item in items) { diff --git a/src/Wpf/Prism.Wpf/Regions/RegionViewRegistry.cs b/src/Wpf/Prism.Wpf/Regions/RegionViewRegistry.cs index 90ad8bd671..fd2c24d14b 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionViewRegistry.cs +++ b/src/Wpf/Prism.Wpf/Regions/RegionViewRegistry.cs @@ -15,7 +15,7 @@ namespace Prism.Regions public class RegionViewRegistry : IRegionViewRegistry { private readonly IContainerProvider _container; - private readonly ListDictionary> _registeredContent = new ListDictionary>(); + private readonly ListDictionary> _registeredContent = new ListDictionary>(); private readonly WeakDelegatesManager _contentRegisteredListeners = new WeakDelegatesManager(); /// @@ -40,13 +40,14 @@ public event EventHandler ContentRegistered /// Returns the contents registered for a region. /// /// Name of the region which content is being requested. + /// The to use to get the View. /// Collection of contents registered for the region. - public IEnumerable GetContents(string regionName) + public IEnumerable GetContents(string regionName, IContainerProvider container) { - List items = new List(); - foreach (Func getContentDelegate in _registeredContent[regionName]) + var items = new List(); + foreach (Func getContentDelegate in _registeredContent[regionName]) { - items.Add(getContentDelegate()); + items.Add(getContentDelegate(container)); } return items; @@ -59,7 +60,7 @@ public IEnumerable GetContents(string regionName) /// Content type to be registered for the . public void RegisterViewWithRegion(string regionName, Type viewType) { - RegisterViewWithRegion(regionName, () => CreateInstance(viewType)); + RegisterViewWithRegion(regionName, _ => CreateInstance(viewType)); } /// @@ -67,12 +68,23 @@ public void RegisterViewWithRegion(string regionName, Type viewType) /// /// Region name to which the will be registered. /// Delegate used to retrieve the content associated with the . - public void RegisterViewWithRegion(string regionName, Func getContentDelegate) + public void RegisterViewWithRegion(string regionName, Func getContentDelegate) { _registeredContent.Add(regionName, getContentDelegate); OnContentRegistered(new ViewRegisteredEventArgs(regionName, getContentDelegate)); } + /// + /// Associate a view with a region, by registering a type. When the region get's displayed + /// this type will be resolved using the ServiceLocator into a concrete instance. The instance + /// will be added to the Views collection of the region + /// + /// The name of the region to associate the view with. + /// The type of the view to register with the + /// The , for adding several views easily + public void RegisterViewWithRegion(string regionName, string targetName) => + RegisterViewWithRegion(regionName, c => c.Resolve(targetName)); + /// /// Creates an instance of a registered view . /// diff --git a/src/Wpf/Prism.Wpf/Regions/UpdateRegionsException.Desktop.cs b/src/Wpf/Prism.Wpf/Regions/UpdateRegionsException.Desktop.cs deleted file mode 100644 index a0bf0de3bf..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/UpdateRegionsException.Desktop.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Prism.Regions -{ - /// - /// Represents errors that occured during the regions' update. - /// - [Serializable] - public partial class UpdateRegionsException - { - /// - /// Initializes a new instance of the class with serialized data. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected UpdateRegionsException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/ViewRegistrationException.Desktop.cs b/src/Wpf/Prism.Wpf/Regions/ViewRegistrationException.Desktop.cs deleted file mode 100644 index 5c4593e68c..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/ViewRegistrationException.Desktop.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Runtime.Serialization; - -namespace Prism.Regions -{ - /// - /// Exception that's thrown when something goes wrong while Registering a View with a region name in the class. - /// - [Serializable] - public partial class ViewRegistrationException - { - /// - /// Initializes a new instance of the class with serialized data. - /// - /// The that holds the serialized - /// object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected ViewRegistrationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs b/src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs index 01182735b1..b7d06f5b1c 100644 --- a/src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs +++ b/src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs @@ -1,5 +1,3 @@ - - using System; using System.Collections; using System.Collections.Generic; From 5891f002fa2d448f492cd90de36f3476f76617c7 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 26 Aug 2023 08:37:24 -0600 Subject: [PATCH 02/19] chore: removing duplicate platform extensions --- .../MauiTestRegionsModule.cs | 4 +- .../ViewModels/RegionViewModelBase.cs | 6 +- .../Regions/IRegionManagerExtensions.cs | 121 ------------------ .../Navigation/NavigationAsyncExtensions.cs | 102 --------------- 4 files changed, 5 insertions(+), 228 deletions(-) delete mode 100644 src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs delete mode 100644 src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs diff --git a/e2e/Maui/MauiRegionsModule/MauiTestRegionsModule.cs b/e2e/Maui/MauiRegionsModule/MauiTestRegionsModule.cs index 6227b93c77..f4fb0ee8e0 100644 --- a/e2e/Maui/MauiRegionsModule/MauiTestRegionsModule.cs +++ b/e2e/Maui/MauiRegionsModule/MauiTestRegionsModule.cs @@ -8,7 +8,7 @@ public class MauiTestRegionsModule : IModule public void OnInitialized(IContainerProvider containerProvider) { var regionManager = containerProvider.Resolve(); - regionManager.RegisterViewWithRegion("ContentRegion", "RegionViewA"); + regionManager.RegisterViewWithRegion("ContentRegion"); } public void RegisterTypes(IContainerRegistry containerRegistry) @@ -23,4 +23,4 @@ public void RegisterTypes(IContainerRegistry containerRegistry) .RegisterForRegionNavigation() .RegisterForRegionNavigation(); } -} \ No newline at end of file +} diff --git a/e2e/Maui/MauiRegionsModule/ViewModels/RegionViewModelBase.cs b/e2e/Maui/MauiRegionsModule/ViewModels/RegionViewModelBase.cs index b602875194..5106d33768 100644 --- a/e2e/Maui/MauiRegionsModule/ViewModels/RegionViewModelBase.cs +++ b/e2e/Maui/MauiRegionsModule/ViewModels/RegionViewModelBase.cs @@ -15,7 +15,7 @@ protected RegionViewModelBase(INavigationService navigationService, IPageAccesso _pageAccessor = pageAccessor; } - public bool IsNavigationTarget(INavigationContext navigationContext) => + public bool IsNavigationTarget(NavigationContext navigationContext) => navigationContext.NavigatedName() == Name; private string? _message; @@ -34,12 +34,12 @@ public int ViewCount public string? PageName => _pageAccessor.Page?.GetType()?.Name; - public void OnNavigatedFrom(INavigationContext navigationContext) + public void OnNavigatedFrom(NavigationContext navigationContext) { } - public void OnNavigatedTo(INavigationContext navigationContext) + public void OnNavigatedTo(NavigationContext navigationContext) { if (navigationContext.Parameters.ContainsKey(nameof(Message))) Message = navigationContext.Parameters.GetValue(nameof(Message)); diff --git a/src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs b/src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs deleted file mode 100644 index 03c1cd29a6..0000000000 --- a/src/Maui/Prism.Maui/Regions/IRegionManagerExtensions.cs +++ /dev/null @@ -1,121 +0,0 @@ -using Prism.Navigation; -using Prism.Regions.Navigation; - -namespace Prism.Regions; - -/// -/// NavigationExtensions for the -/// -public static class IRegionManagerExtensions -{ - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target) - { - RequestNavigate(regionManager, regionName, target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - regionManager.RequestNavigate(regionName, targetUri, navigationCallback); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri target) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - regionManager.RequestNavigate(regionName, target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The name of the Region to navigate to. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, Action navigationCallback, INavigationParameters regionParameters) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - regionManager.RequestNavigate(regionName, targetUri, navigationCallback, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The RegionManager object. - /// The name of the Region to navigate to. - /// A Uri that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, Uri target, INavigationParameters regionParameters) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - regionManager.RequestNavigate(regionName, target, nr => { }, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The RegionManager object. - /// The name of the Region to navigate to. - /// A string that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this IRegionManager regionManager, string regionName, string target, INavigationParameters regionParameters) - { - if (regionManager == null) - throw new ArgumentNullException(nameof(regionManager)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - regionManager.RequestNavigate(regionName, new Uri(target, UriKind.RelativeOrAbsolute), nr => { }, regionParameters); - } - - /// - /// Associate a view with a region, by registering a type. When the region get's displayed - /// this type will be resolved using the ServiceLocator into a concrete instance. The instance - /// will be added to the Views collection of the region - /// - /// The type of the view to register with the . - /// The current . - /// The name of the region to associate the view with. - /// The , for adding several views easily - public static IRegionManager RegisterViewWithRegion(this IRegionManager regionManager, string regionName) => - regionManager.RegisterViewWithRegion(regionName, typeof(T)); -} diff --git a/src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs b/src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs deleted file mode 100644 index d3e4c0d48a..0000000000 --- a/src/Maui/Prism.Maui/Regions/Navigation/NavigationAsyncExtensions.cs +++ /dev/null @@ -1,102 +0,0 @@ -using Prism.Navigation; - -namespace Prism.Regions.Navigation; - -/// -/// Provides additional methods to the interface. -/// -public static class NavigationAsyncExtensions -{ - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - public static void RequestNavigate(this INavigateAsync navigation, string target) - { - RequestNavigate(navigation, target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - /// The callback executed when the navigation request is completed. - public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - navigation.RequestNavigate(targetUri, navigationCallback); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - public static void RequestNavigate(this INavigateAsync navigation, Uri target) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - navigation.RequestNavigate(target, nr => { }); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// The navigation target - /// The callback executed when the navigation request is completed. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this INavigateAsync navigation, string target, Action navigationCallback, INavigationParameters regionParameters) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - var targetUri = new Uri(target, UriKind.RelativeOrAbsolute); - - navigation.RequestNavigate(targetUri, navigationCallback, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// A Uri that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this INavigateAsync navigation, Uri target, INavigationParameters regionParameters) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - navigation.RequestNavigate(target, nr => { }, regionParameters); - } - - /// - /// Initiates navigation to the target specified by the . - /// - /// The navigation object. - /// A string that represents the target where the region will navigate. - /// An instance of NavigationParameters, which holds a collection of object parameters. - public static void RequestNavigate(this INavigateAsync navigation, string target, INavigationParameters regionParameters) - { - if (navigation == null) - throw new ArgumentNullException(nameof(navigation)); - - if (target == null) - throw new ArgumentNullException(nameof(target)); - - navigation.RequestNavigate(new Uri(target, UriKind.RelativeOrAbsolute), nr => { }, regionParameters); - } -} From 01ec1ef8dae477fd296008ab2dcf304524b233c1 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 26 Aug 2023 10:29:52 -0600 Subject: [PATCH 03/19] chore: migrating NavigationResult to Prism.Core --- .../HelloRegions/ViewModels/RegionDemoBase.cs | 2 +- .../Navigation/INavigationResult.cs | 18 ----- .../Navigation/NavigationException.cs | 32 --------- .../Navigation/PageNavigationService.cs | 42 ++++++------ .../INavigationServiceExtensions.cs | 2 +- .../Navigation/INavigationResult.cs | 12 ---- .../Prism.Maui/Navigation/NavigationResult.cs | 12 ---- .../Navigation/INavigationResult.cs | 32 +++++++++ .../Navigation/NavigationException.cs | 18 +++-- src/Prism.Core/Navigation/NavigationResult.cs | 65 +++++++++++++++++++ src/Prism.Core/Regions/NavigationResult.cs | 51 --------------- .../Regions/RegionNavigationJournal.cs | 10 +-- 12 files changed, 136 insertions(+), 160 deletions(-) delete mode 100644 src/Forms/Prism.Forms/Navigation/INavigationResult.cs delete mode 100644 src/Forms/Prism.Forms/Navigation/NavigationException.cs delete mode 100644 src/Maui/Prism.Maui/Navigation/INavigationResult.cs delete mode 100644 src/Maui/Prism.Maui/Navigation/NavigationResult.cs create mode 100644 src/Prism.Core/Navigation/INavigationResult.cs rename src/{Maui/Prism.Maui => Prism.Core}/Navigation/NavigationException.cs (85%) create mode 100644 src/Prism.Core/Navigation/NavigationResult.cs delete mode 100644 src/Prism.Core/Regions/NavigationResult.cs diff --git a/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs b/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs index d0a6c21d8b..0d0bfd46b6 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs @@ -1,4 +1,4 @@ -using System; +using System; using Prism.Commands; using Prism.Mvvm; using Prism.Navigation; diff --git a/src/Forms/Prism.Forms/Navigation/INavigationResult.cs b/src/Forms/Prism.Forms/Navigation/INavigationResult.cs deleted file mode 100644 index f76eda462b..0000000000 --- a/src/Forms/Prism.Forms/Navigation/INavigationResult.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; - -namespace Prism.Navigation -{ - public interface INavigationResult - { - bool Success { get; } - - Exception Exception { get; } - } - - public class NavigationResult : INavigationResult - { - public bool Success { get; set; } - - public Exception Exception { get; set; } - } -} diff --git a/src/Forms/Prism.Forms/Navigation/NavigationException.cs b/src/Forms/Prism.Forms/Navigation/NavigationException.cs deleted file mode 100644 index 19159706a0..0000000000 --- a/src/Forms/Prism.Forms/Navigation/NavigationException.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System; -using Xamarin.Forms; - -namespace Prism.Navigation -{ - public class NavigationException : Exception - { - public const string CannotPopApplicationMainPage = "Cannot Pop Application MainPage"; - public const string CannotGoBackFromRoot = "Cannot GoBack from NavigationPage Root."; - public const string GoBackToRootRequiresNavigationPage = "GoBackToRootAsync can only be called when the calling Page is within a NavigationPage."; - public const string RelativeNavigationRequiresNavigationPage = "Removing views using the relative '../' syntax while navigating is only supported within a NavigationPage"; - public const string IConfirmNavigationReturnedFalse = "IConfirmNavigation returned false"; - public const string NoPageIsRegistered = "No Page has been registered with the provided key"; - public const string ErrorCreatingPage = "An error occurred while resolving the page. This is most likely the result of invalid XAML or other type initialization exception"; - public const string UnknownException = "An unknown error occurred. You may need to specify whether to Use Modal Navigation or not."; - - public NavigationException() - { - } - - public NavigationException(string message, Page page) : this(message, page, null) - { - } - - public NavigationException(string message, Page page, Exception innerException) : base(message, innerException) - { - Page = page; - } - - public Page Page { get; } - } -} diff --git a/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs b/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs index 103078447b..dd387c818a 100644 --- a/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs +++ b/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs @@ -86,7 +86,6 @@ public virtual Task GoBackAsync(INavigationParameters paramet /// If true a go back operation was successful. If false the go back operation failed. protected async virtual Task GoBackInternal(INavigationParameters parameters, bool? useModalNavigation, bool animated) { - var result = new NavigationResult(); Page page = null; try { @@ -102,8 +101,10 @@ protected async virtual Task GoBackInternal(INavigationParame var canNavigate = await PageUtilities.CanNavigateAsync(page, segmentParameters); if (!canNavigate) { - result.Exception = new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page); - return result; + return new NavigationResult + { + Exception = new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page) + }; } bool useModalForDoPop = UseModalGoBack(page, useModalNavigation); @@ -116,22 +117,22 @@ protected async virtual Task GoBackInternal(INavigationParame PageUtilities.OnNavigatedTo(previousPage, segmentParameters); PageUtilities.DestroyPage(poppedPage); - result.Success = true; - return result; + return new NavigationResult(); } } catch (Exception ex) { - result.Exception = ex; - return result; + return new NavigationResult { Exception = ex }; } finally { NavigationSource = PageNavigationSource.Device; } - result.Exception = GetGoBackException(page, _applicationProvider.MainPage); - return result; + return new NavigationResult + { + Exception = GetGoBackException(page, _applicationProvider.MainPage) + }; } private static Exception GetGoBackException(Page currentPage, Page mainPage) @@ -196,7 +197,6 @@ public virtual Task GoBackToRootAsync(INavigationParameters p /// Only works when called from a View within a NavigationPage protected async virtual Task GoBackToRootInternal(INavigationParameters parameters) { - var result = new NavigationResult(); Page page = null; try { @@ -209,8 +209,10 @@ protected async virtual Task GoBackToRootInternal(INavigation var canNavigate = await PageUtilities.CanNavigateAsync(page, parameters); if (!canNavigate) { - result.Exception = new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page); - return result; + return new NavigationResult + { + Exception = new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page) + }; } List pagesToDestroy = page.Navigation.NavigationStack.ToList(); // get all pages to destroy @@ -228,13 +230,11 @@ protected async virtual Task GoBackToRootInternal(INavigation PageUtilities.OnNavigatedTo(root, parameters); - result.Success = true; - return result; + return new NavigationResult(); } catch (Exception ex) { - result.Exception = ex; - return result; + return new NavigationResult { Exception = ex }; } } @@ -341,7 +341,6 @@ public virtual Task NavigateAsync(Uri uri, INavigationParamet /// protected async virtual Task NavigateInternal(Uri uri, INavigationParameters parameters, bool? useModalNavigation, bool animated) { - var result = new NavigationResult(); try { NavigationSource = PageNavigationSource.NavigationService; @@ -351,21 +350,18 @@ protected async virtual Task NavigateInternal(Uri uri, INavig if (uri.IsAbsoluteUri) { await ProcessNavigationForAbsoulteUri(navigationSegments, parameters, useModalNavigation, animated); - result.Success = true; - return result; + return new NavigationResult(); } else { await ProcessNavigation(GetCurrentPage(), navigationSegments, parameters, useModalNavigation, animated); - result.Success = true; - return result; + return new NavigationResult(); } } catch (Exception ex) { - result.Exception = ex; - return result; + return new NavigationResult { Exception = ex }; } finally { diff --git a/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs b/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs index 7aa531391a..69a8d6de10 100644 --- a/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs +++ b/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs @@ -80,7 +80,7 @@ public static async Task SelectTabAsync(this INavigationServi return new NavigationResult { Exception = ex }; } - return new NavigationResult { Success = true }; + return new NavigationResult(); } } } diff --git a/src/Maui/Prism.Maui/Navigation/INavigationResult.cs b/src/Maui/Prism.Maui/Navigation/INavigationResult.cs deleted file mode 100644 index f40131b5cf..0000000000 --- a/src/Maui/Prism.Maui/Navigation/INavigationResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Prism.Navigation; - -public interface INavigationResult -{ - bool Success => Exception is null; - - bool Cancelled => - Exception is NavigationException navigationException - && navigationException.Message == NavigationException.IConfirmNavigationReturnedFalse; - - Exception Exception { get; } -} diff --git a/src/Maui/Prism.Maui/Navigation/NavigationResult.cs b/src/Maui/Prism.Maui/Navigation/NavigationResult.cs deleted file mode 100644 index e561748c49..0000000000 --- a/src/Maui/Prism.Maui/Navigation/NavigationResult.cs +++ /dev/null @@ -1,12 +0,0 @@ -namespace Prism.Navigation; - -public record NavigationResult : INavigationResult -{ - public bool Success => Exception is null; - - public bool Cancelled => - Exception is NavigationException navigationException - && navigationException.Message == NavigationException.IConfirmNavigationReturnedFalse; - - public Exception Exception { get; init; } -} diff --git a/src/Prism.Core/Navigation/INavigationResult.cs b/src/Prism.Core/Navigation/INavigationResult.cs new file mode 100644 index 0000000000..aef44b44b3 --- /dev/null +++ b/src/Prism.Core/Navigation/INavigationResult.cs @@ -0,0 +1,32 @@ +using System; +using Prism.Regions; + +namespace Prism.Navigation; + +#nullable enable +/// +/// Provides a wrapper for a Navigation Result +/// +public interface INavigationResult +{ + /// + /// Indicates that the navigation was successful and no Navigation Errors occurred + /// + bool Success { get; } + + /// + /// If true this indicates that the Navigation Event was cancelled. + /// + bool Cancelled { get; } + + /// + /// The Exception if one occurred. + /// + Exception? Exception { get; } + + /// + /// If the is the result of Region Navigation + /// This will provide the associate + /// + NavigationContext? Context { get; } +} diff --git a/src/Maui/Prism.Maui/Navigation/NavigationException.cs b/src/Prism.Core/Navigation/NavigationException.cs similarity index 85% rename from src/Maui/Prism.Maui/Navigation/NavigationException.cs rename to src/Prism.Core/Navigation/NavigationException.cs index 848c671432..f1d39146bb 100644 --- a/src/Maui/Prism.Maui/Navigation/NavigationException.cs +++ b/src/Prism.Core/Navigation/NavigationException.cs @@ -1,3 +1,5 @@ +using System; + namespace Prism.Navigation; public class NavigationException : Exception @@ -25,7 +27,7 @@ public NavigationException(string message) { } - public NavigationException(string message, VisualElement view) + public NavigationException(string message, object view) : this(message, view, null) { } @@ -40,18 +42,24 @@ public NavigationException(string message, string navigationKey, Exception inner { } - public NavigationException(string message, VisualElement view, Exception innerException) + public NavigationException(string message, object view, Exception innerException) : this(message, null, view, innerException) { } - public NavigationException(string message, string navigationKey, VisualElement view, Exception innerException) : base(message, innerException) + public NavigationException(string message, string navigationKey, object view, Exception innerException) : base(message, innerException) { View = view; NavigationKey = navigationKey; } - public VisualElement View { get; } + /// + /// The View Instance + /// + public object View { get; } + /// + /// The key used for the failed navigation + /// public string NavigationKey { get; } -} \ No newline at end of file +} diff --git a/src/Prism.Core/Navigation/NavigationResult.cs b/src/Prism.Core/Navigation/NavigationResult.cs new file mode 100644 index 0000000000..69198f3504 --- /dev/null +++ b/src/Prism.Core/Navigation/NavigationResult.cs @@ -0,0 +1,65 @@ +using System; +using Prism.Regions; + +namespace Prism.Navigation; + +#nullable enable +/// +/// Default implementation for the +/// +public record NavigationResult : INavigationResult +{ + private readonly bool? _success; + + /// + /// Initializes a new Navigation Result + /// + public NavigationResult() + { + } + + /// + /// Initializes a new NavigationResult + /// + /// + public NavigationResult(bool success) + { + _success = success; + } + + /// + /// Initializes a new NavigationResult + /// + /// + /// + public NavigationResult(NavigationContext context, bool success) + { + Context = context; + _success = success; + } + + /// + /// Initializes a new NavigationResult + /// + /// + /// + public NavigationResult(NavigationContext context, Exception exception) + { + Context = context; + Exception = exception; + } + + /// + public bool Success => _success ?? Exception is null; + + /// + public bool Cancelled => + Exception is NavigationException navigationException + && navigationException.Message == NavigationException.IConfirmNavigationReturnedFalse; + + /// + public Exception? Exception { get; init; } + + /// + public NavigationContext? Context { get; init; } +} diff --git a/src/Prism.Core/Regions/NavigationResult.cs b/src/Prism.Core/Regions/NavigationResult.cs deleted file mode 100644 index 82bc6ed764..0000000000 --- a/src/Prism.Core/Regions/NavigationResult.cs +++ /dev/null @@ -1,51 +0,0 @@ -using System; - -namespace Prism.Regions -{ - /// - /// Represents the result of navigating to a URI. - /// - public class NavigationResult - { - /// - /// Initializes a new instance of the class. - /// - /// The context. - /// The result. - public NavigationResult(NavigationContext context, bool? result) - { - Context = context; - Result = result; - } - - /// - /// Initializes a new instance of the class. - /// - /// The context. - /// The error. - public NavigationResult(NavigationContext context, Exception error) - { - Context = context; - Error = error; - Result = false; - } - - /// - /// Gets the result. - /// - /// The result. - public bool? Result { get; private set; } - - /// - /// Gets an exception that occurred while navigating. - /// - /// The exception. - public Exception Error { get; private set; } - - /// - /// Gets the navigation context. - /// - /// The navigation context. - public NavigationContext Context { get; private set; } - } -} diff --git a/src/Prism.Core/Regions/RegionNavigationJournal.cs b/src/Prism.Core/Regions/RegionNavigationJournal.cs index 75ec8dcd21..bce7af269a 100644 --- a/src/Prism.Core/Regions/RegionNavigationJournal.cs +++ b/src/Prism.Core/Regions/RegionNavigationJournal.cs @@ -141,16 +141,16 @@ public void Clear() private void InternalNavigate(IRegionNavigationJournalEntry entry, Action callback) { - this.isNavigatingInternal = true; - this.NavigationTarget.RequestNavigate( + isNavigatingInternal = true; + NavigationTarget.RequestNavigate( entry.Uri, nr => { - this.isNavigatingInternal = false; + isNavigatingInternal = false; - if (nr.Result.HasValue) + if (nr.Success) { - callback(nr.Result.Value); + callback(nr.Success); } }, entry.Parameters); From 6a09b9ba6b618603a4eee718c8a85e3753706022 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 26 Aug 2023 11:31:34 -0600 Subject: [PATCH 04/19] chore: updating tests for namespace & type name breaks --- .../Regions/Adapters/IRegionAdapter.cs | 18 -- .../Regions/Adapters/RegionAdapterBase.cs | 2 +- .../Fixtures/Regions/RegionFixture.cs | 2 +- .../ViewModels/Issue2415PageViewModel.cs | 4 +- .../Mocks/MockPresentationRegion.cs | 23 ++- .../Mocks/MockRegion.cs | 22 +-- .../Mocks/MockRegionAdapter.cs | 7 +- .../Mocks/MockRegionBehaviorCollection.cs | 2 +- .../Mocks/MockViewsCollection.cs | 8 +- .../LocatorNavigationTargetHandlerFixture.cs | 8 +- .../Tests/NavigationAsyncExtensionsFixture.cs | 9 +- .../Tests/RegionBehaviorCollectionFixture.cs | 2 +- .../Tests/RegionBehaviorFactoryFixture.cs | 2 +- .../Tests/RegionBehaviorFixture.cs | 1 + .../Tests/RegionFixture.cs | 2 +- .../Tests/RegionManagerFixture.cs | 11 +- .../RegionManagerRequestNavigateFixture.cs | 20 +- .../Tests/RegionNavigationJournalFixture.cs | 145 +++++++-------- .../Tests/RegionNavigationServiceFixture.cs | 173 +++++++++--------- .../Tests/RegionViewRegistryFixture.cs | 2 +- .../Fixtures/Regions/RegionFixture.cs | 3 +- .../ViewModels/MockRegionViewAViewModel.cs | 6 +- .../Mocks/MockRegionManager.cs | 6 + .../Mocks/MockRegionManager.cs | 3 +- .../AutoPopulateRegionBehaviorFixture.cs | 12 +- ...egionManagerRegistrationBehaviorFixture.cs | 3 +- .../NavigationAsyncExtensionsFixture.cs | 1 + .../Prism.Wpf.Tests/Regions/RegionFixture.cs | 2 +- .../Regions/RegionManagerFixture.cs | 15 +- .../RegionManagerRequestNavigateFixture.cs | 8 +- .../RegionNavigationServiceFixture.new.cs | 45 ++--- .../Regions/RegionViewRegistryFixture.cs | 2 +- 32 files changed, 294 insertions(+), 275 deletions(-) delete mode 100644 src/Forms/Prism.Forms.Regions/Regions/Adapters/IRegionAdapter.cs diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/IRegionAdapter.cs b/src/Forms/Prism.Forms.Regions/Regions/Adapters/IRegionAdapter.cs deleted file mode 100644 index 70387f7918..0000000000 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/IRegionAdapter.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Xamarin.Forms; - -namespace Prism.Regions.Adapters -{ - /// - /// Defines an interfaces to adapt an object and bind it to a new . - /// - public interface IRegionAdapter - { - /// - /// Adapts an object and binds it to a new . - /// - /// The object to adapt. - /// The name of the region to be created. - /// The new instance of that the is bound to. - IRegion Initialize(VisualElement regionTarget, string regionName); - } -} diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs b/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs index 750194d9f1..7ca851c3df 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs @@ -55,7 +55,7 @@ public IRegion Initialize(T regionTarget, string regionName) /// is of type . /// When is . /// When is not of type . - IRegion IRegionAdapter.Initialize(VisualElement regionTarget, string regionName) + IRegion IRegionAdapter.Initialize(object regionTarget, string regionName) { return Initialize(GetCastedObject(regionTarget), regionName); } diff --git a/tests/Forms/Prism.DI.Forms.Tests/Fixtures/Regions/RegionFixture.cs b/tests/Forms/Prism.DI.Forms.Tests/Fixtures/Regions/RegionFixture.cs index 9377d62edc..a0a9fe6c19 100644 --- a/tests/Forms/Prism.DI.Forms.Tests/Fixtures/Regions/RegionFixture.cs +++ b/tests/Forms/Prism.DI.Forms.Tests/Fixtures/Regions/RegionFixture.cs @@ -31,7 +31,7 @@ public async Task RegionWorksWhenContentViewIsTopChild() var vm = _app.MainPage.BindingContext as Issue2415PageViewModel; Assert.NotNull(vm.Result); - Assert.True(vm.Result.Result); + Assert.True(vm.Result.Success); } void IPlatformInitializer.RegisterTypes(IContainerRegistry containerRegistry) diff --git a/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs b/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs index c026bfae9b..8bd37abb2a 100644 --- a/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs +++ b/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs @@ -18,14 +18,14 @@ public Issue2415PageViewModel(IRegionManager regionManager) _regionManager = regionManager; } - public IRegionNavigationResult Result { get; private set; } + public NavigationResult Result { get; private set; } public void Initialize(INavigationParameters parameters) { _regionManager.RequestNavigate("ContentRegion", "Issue2415RegionView", NavigationCallback); } - private void NavigationCallback(IRegionNavigationResult result) + private void NavigationCallback(NavigationResult result) { Result = result; } diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs index b27a74baf5..f9d068c32c 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs @@ -17,35 +17,35 @@ public MockPresentationRegion() { Behaviors = new MockRegionBehaviorCollection(); } - public IRegionManager Add(VisualElement view) + public IRegionManager Add(object view) { MockViews.Items.Add(view); return null; } - public void Remove(VisualElement view) + public void Remove(object view) { MockViews.Items.Remove(view); MockActiveViews.Items.Remove(view); } - public void Activate(VisualElement view) + public void Activate(object view) { MockActiveViews.Items.Add(view); } - public IRegionManager Add(VisualElement view, string viewName) + public IRegionManager Add(object view, string viewName) { throw new NotImplementedException(); } - public IRegionManager Add(VisualElement view, string viewName, bool createRegionManagerScope) + public IRegionManager Add(object view, string viewName, bool createRegionManagerScope) { throw new NotImplementedException(); } - public VisualElement GetView(string viewName) + public object GetView(string viewName) { throw new NotImplementedException(); } @@ -103,12 +103,12 @@ public bool Navigate(Uri source) throw new NotImplementedException(); } - public void RequestNavigate(Uri target, Action navigationCallback) + public void RequestNavigate(Uri target, Action navigationCallback) { throw new NotImplementedException(); } - public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) + public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) { throw new NotImplementedException(); } @@ -118,6 +118,11 @@ public void RemoveAll() throw new NotImplementedException(); } + public void Deactivate(object view) + { + throw new NotImplementedException(); + } + public IRegionNavigationService NavigationService { get => throw new NotImplementedException(); @@ -125,7 +130,7 @@ public IRegionNavigationService NavigationService } - public Comparison SortComparison + public Comparison SortComparison { get => throw new NotImplementedException(); set => throw new NotImplementedException(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs index ae6208a840..4dd6d763f4 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs @@ -11,7 +11,7 @@ namespace Prism.Forms.Regions.Mocks internal class MockRegion : IRegion { public event PropertyChangedEventHandler PropertyChanged; - public Func GetViewStringDelegate { get; set; } + public Func GetViewStringDelegate { get; set; } private MockViewsCollection _views = new MockViewsCollection(); @@ -33,38 +33,38 @@ public NavigationParameters NavigationParameters public string Name { get; set; } - public IRegionManager Add(VisualElement view) + public IRegionManager Add(object view) { _views.Add(view); return null; } - public IRegionManager Add(VisualElement view, string viewName) + public IRegionManager Add(object view, string viewName) { return Add(view); } - public IRegionManager Add(VisualElement view, string viewName, bool createRegionManagerScope) + public IRegionManager Add(object view, string viewName, bool createRegionManagerScope) { throw new NotImplementedException(); } - public void Remove(VisualElement view) + public void Remove(object view) { throw new NotImplementedException(); } - public void Activate(VisualElement view) + public void Activate(object view) { throw new NotImplementedException(); } - public void Deactivate(VisualElement view) + public void Deactivate(object view) { throw new NotImplementedException(); } - public VisualElement GetView(string viewName) + public object GetView(string viewName) { return GetViewStringDelegate(viewName); } @@ -82,12 +82,12 @@ public bool Navigate(Uri source) } - public void RequestNavigate(Uri target, Action navigationCallback) + public void RequestNavigate(Uri target, Action navigationCallback) { throw new NotImplementedException(); } - public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) + public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) { throw new NotImplementedException(); } @@ -104,7 +104,7 @@ public IRegionNavigationService NavigationService } - public Comparison SortComparison + public Comparison SortComparison { get => throw new NotImplementedException(); set => throw new NotImplementedException(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs index 2454fdcfbd..bb9cc19e50 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs @@ -11,14 +11,15 @@ internal class MockRegionAdapter : IRegionAdapter public MockRegionManagerAccessor Accessor; - public IRegion Initialize(VisualElement regionTarget, string regionName) + public IRegion Initialize(object regionTarget, string regionName) { CreatedRegions.Add(regionName); var region = new MockPresentationRegion(); - Prism.Regions.Xaml.RegionManager.GetObservableRegion(regionTarget).Value = region; + if (regionTarget is VisualElement element) + Prism.Regions.Xaml.RegionManager.GetObservableRegion(element).Value = region; - // Fire update regions again. This also happens if a region is created and added to the regionmanager + // Fire update regions again. This also happens if a region is created and added to the RegionManager if (Accessor != null) Accessor.UpdateRegions(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs index 13b12aee7f..15b1c88a25 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs @@ -1,6 +1,6 @@ using System.Collections; using System.Collections.Generic; -using Prism.Regions.Behaviors; +using Prism.Regions; namespace Prism.Forms.Regions.Mocks { diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs index a72e409bde..cb44f68569 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs @@ -9,19 +9,19 @@ namespace Prism.Forms.Regions.Mocks { internal class MockViewsCollection : IViewsCollection { - public ObservableCollection Items = new ObservableCollection(); + public ObservableCollection Items = new ObservableCollection(); - public void Add(VisualElement view) + public void Add(object view) { Items.Add(view); } - public bool Contains(VisualElement value) + public bool Contains(object value) { return Items.Contains(value); } - public IEnumerator GetEnumerator() + public IEnumerator GetEnumerator() { return Items.GetEnumerator(); } diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs index 9018e75a5e..a83b9808db 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs @@ -124,7 +124,7 @@ public void WhenViewExistsAndImplementsIRegionAware_ThenViewIsQueriedForNavigati var viewMock = new Mock(); viewMock .As() - .Setup(v => v.IsNavigationTarget(It.IsAny())) + .Setup(v => v.IsNavigationTarget(It.IsAny())) .Returns(true) .Verifiable(); @@ -157,7 +157,7 @@ public void WhenViewExistsAndHasDataContextThatImplementsIRegionAware_ThenDataCo var bindingContextMock = new Mock(); bindingContextMock - .Setup(v => v.IsNavigationTarget(It.IsAny())) + .Setup(v => v.IsNavigationTarget(It.IsAny())) .Returns(true) .Verifiable(); var viewMock = new Mock(); @@ -226,7 +226,7 @@ public void WhenViewExistsAndImplementsIRegionAware_ThenViewIsQueriedForNavigati var viewMock = new Mock(); viewMock .As() - .Setup(v => v.IsNavigationTarget(It.IsAny())) + .Setup(v => v.IsNavigationTarget(It.IsAny())) .Returns(false) .Verifiable(); @@ -265,7 +265,7 @@ public void WhenViewExistsAndHasDataContextThatImplementsIRegionAware_ThenDataCo var bindingContextMock = new Mock(); bindingContextMock - .Setup(v => v.IsNavigationTarget(It.IsAny())) + .Setup(v => v.IsNavigationTarget(It.IsAny())) .Returns(false) .Verifiable(); var viewMock = new Mock(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs index c042d82290..dfadb836bb 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs @@ -2,7 +2,8 @@ using System.Collections.Generic; using System.Text; using Moq; -using Prism.Regions.Navigation; +using Prism.Navigation; +using Prism.Regions; using Xunit; namespace Prism.Forms.Regions.Tests @@ -43,7 +44,7 @@ public void WhenNavigatingWithARelativeStringTarget_ThenNavigatesToRelativeUri() .Setup(nv => nv.RequestNavigate( It.Is(u => !u.IsAbsoluteUri && u.OriginalString == "relative"), - It.Is>(c => c != null))) + It.Is>(c => c != null))) .Verifiable(); string target = "relative"; @@ -61,7 +62,7 @@ public void WhenNavigatingWithAnAbsoluteStringTarget_ThenNavigatesToAbsoluteUri( .Setup(nv => nv.RequestNavigate( It.Is(u => u.IsAbsoluteUri && u.Host == "test" && u.AbsolutePath == "/path"), - It.Is>(c => c != null))) + It.Is>(c => c != null))) .Verifiable(); string target = "http://test/path"; @@ -94,7 +95,7 @@ public void WhenNavigatingWithAUri_ThenNavigatesToUriWithCallback() .Setup(nv => nv.RequestNavigate( target, - It.Is>(c => c != null))) + It.Is>(c => c != null))) .Verifiable(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs index 637d4e8537..4823622cae 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Regions.Behaviors; +using Prism.Regions; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs index f68520deb2..d5ac28bb02 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs @@ -4,7 +4,7 @@ using Moq; using Prism.Forms.Regions.Mocks; using Prism.Ioc; -using Prism.Regions.Behaviors; +using Prism.Regions; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs index 653cc0dbc5..1dad26097c 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Text; using Prism.Forms.Regions.Mocks; +using Prism.Regions; using Prism.Regions.Behaviors; using Xunit; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs index 437ec89585..e67c294150 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs @@ -484,7 +484,7 @@ public void NavigateDelegatesToIRegionNavigationService() region.Add(view); var uri = new Uri(view.GetType().Name, UriKind.Relative); - Action navigationCallback = nr => { }; + Action navigationCallback = nr => { }; var navigationParameters = new NavigationParameters(); var mockRegionNavigationService = new Mock(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs index 5876236876..70095001c8 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs @@ -479,19 +479,24 @@ public FrameworkException(Exception inner) internal class MockRegionContentRegistry : IRegionViewRegistry { public Func RegisterContentWithViewType; - public Func, object> RegisterContentWithDelegate; + public Func, object> RegisterContentWithDelegate; public event EventHandler ContentRegistered; - public IEnumerable GetContents(string regionName) + public IEnumerable GetContents(string regionName, IContainerProvider container) { return null; } + public void RegisterViewWithRegion(string regionName, string targetName) + { + throw new NotImplementedException(); + } + void IRegionViewRegistry.RegisterViewWithRegion(string regionName, Type viewType) { RegisterContentWithViewType?.Invoke(regionName, viewType); } - void IRegionViewRegistry.RegisterViewWithRegion(string regionName, Func getContentDelegate) + void IRegionViewRegistry.RegisterViewWithRegion(string regionName, Func getContentDelegate) { RegisterContentWithDelegate?.Invoke(regionName, getContentDelegate); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs index 1ca5791d87..925519d853 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs @@ -17,7 +17,7 @@ public class RegionManagerRequestNavigateFixture private static Uri sourceUri = new Uri(source, UriKind.RelativeOrAbsolute); private static INavigationParameters parameters = new NavigationParameters(); - private static Action callback = (_) => { }; + private static Action callback = (_) => { }; private static Mock mockRegion; private static Mock mockNavigation; @@ -53,51 +53,51 @@ public void DoesNotThrowWhenNavigationCallbackIsNull() [Fact] public void WhenNonExistentRegion_ReturnNavigationResultFalse() { - IRegionNavigationResult result; + NavigationResult result; result = null; regionManager.RequestNavigate(nonExistentRegion, source, (r) => result = r, parameters); - Assert.Equal(false, result.Result); + Assert.False(result.Success); result = null; regionManager.RequestNavigate(nonExistentRegion, source, (r) => result = r); - Assert.Equal(false, result.Result); + Assert.False(result.Success); result = null; regionManager.RequestNavigate(nonExistentRegion, sourceUri, (r) => result = r, parameters); - Assert.Equal(false, result.Result); + Assert.False(result.Success); result = null; regionManager.RequestNavigate(nonExistentRegion, sourceUri, (r) => result = r); - Assert.Equal(false, result.Result); + Assert.False(result.Success); } [Fact] public void DelegatesCallToRegion_RegionSource() { regionManager.RequestNavigate(region, source); - mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), null)); + mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), null)); } [Fact] public void DelegatesCallToRegion_RegionTarget() { regionManager.RequestNavigate(region, sourceUri); - mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), null)); + mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), null)); } [Fact] public void DelegatesCallToRegion_RegionSourceParameters() { regionManager.RequestNavigate(region, source, parameters); - mockRegion.Verify((r) => r.NavigationService.RequestNavigate(sourceUri, It.IsAny>(), parameters)); + mockRegion.Verify((r) => r.NavigationService.RequestNavigate(sourceUri, It.IsAny>(), parameters)); } [Fact] public void DelegatesCallToRegion_RegionSourceUriParameters() { regionManager.RequestNavigate(region, sourceUri, parameters); - mockRegion.Verify((r) => r.NavigationService.RequestNavigate(sourceUri, It.IsAny>(), parameters)); + mockRegion.Verify((r) => r.NavigationService.RequestNavigate(sourceUri, It.IsAny>(), parameters)); } [Fact] diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs index c500b8792f..a444489dd7 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs @@ -3,6 +3,7 @@ using System.Text; using Moq; using Prism.Navigation; +using Prism.Regions; using Prism.Regions.Navigation; using Xunit; @@ -134,14 +135,14 @@ public void GoBackNavigatesBack() mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); // Act target.GoBack(); @@ -151,9 +152,9 @@ public void GoBackNavigatesBack() Assert.True(target.CanGoForward); Assert.Same(entry2, target.CurrentEntry); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); } [Fact] @@ -180,14 +181,14 @@ public void GoBackDoesNotChangeStateWhenNavigationFails() mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, false))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, false))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); // Act target.GoBack(); @@ -197,9 +198,9 @@ public void GoBackDoesNotChangeStateWhenNavigationFails() Assert.False(target.CanGoForward); Assert.Same(entry3, target.CurrentEntry); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); } [Fact] @@ -226,14 +227,14 @@ public void GoBackMultipleTimesNavigatesBack() mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); // Act target.GoBack(); @@ -244,9 +245,9 @@ public void GoBackMultipleTimesNavigatesBack() Assert.True(target.CanGoForward); Assert.Same(entry1, target.CurrentEntry); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); } [Fact] @@ -272,14 +273,14 @@ public void GoForwardNavigatesForward() target.RecordNavigation(entry3, true); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); target.GoBack(); target.GoBack(); @@ -292,9 +293,9 @@ public void GoForwardNavigatesForward() Assert.True(target.CanGoForward); Assert.Same(entry2, target.CurrentEntry); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Exactly(2)); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Exactly(2)); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); } [Fact] @@ -320,14 +321,14 @@ public void GoForwardDoesNotChangeStateWhenNavigationFails() target.RecordNavigation(entry3, true); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, false))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, false))); target.GoBack(); @@ -339,9 +340,9 @@ public void GoForwardDoesNotChangeStateWhenNavigationFails() Assert.True(target.CanGoForward); Assert.Same(entry2, target.CurrentEntry); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Once()); } [Fact] @@ -367,14 +368,14 @@ public void GoForwardMultipleTimesNavigatesForward() target.RecordNavigation(entry3, true); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); target.GoBack(); target.GoBack(); @@ -388,9 +389,9 @@ public void GoForwardMultipleTimesNavigatesForward() Assert.False(target.CanGoForward); Assert.Same(entry3, target.CurrentEntry); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Exactly(2)); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Exactly(2)); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Once()); } [Fact] @@ -418,14 +419,14 @@ public void WhenNavigationToNewUri_ThenCanNoLongerNavigateForward() target.RecordNavigation(entry2, true); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); target.GoBack(); @@ -466,17 +467,17 @@ public void WhenSavePreviousFalseDoNotRecordEntry() target.RecordNavigation(entry4, true); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri1, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri2, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri3, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); mockNavigationTarget - .Setup(x => x.RequestNavigate(uri4, It.IsAny>(), null)) - .Callback, INavigationParameters>((u, c, n) => c(new RegionNavigationResult(null, true))); + .Setup(x => x.RequestNavigate(uri4, It.IsAny>(), null)) + .Callback, INavigationParameters>((u, c, n) => c(new NavigationResult(null, true))); Assert.Equal(entry4, target.CurrentEntry); @@ -486,10 +487,10 @@ public void WhenSavePreviousFalseDoNotRecordEntry() Assert.True(target.CanGoForward); Assert.Same(entry2, target.CurrentEntry); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); - mockNavigationTarget.Verify(x => x.RequestNavigate(uri4, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri1, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri2, It.IsAny>(), null), Times.Once()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri3, It.IsAny>(), null), Times.Never()); + mockNavigationTarget.Verify(x => x.RequestNavigate(uri4, It.IsAny>(), null), Times.Never()); } } } diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs index d9ed454828..afdcaea510 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs @@ -3,6 +3,7 @@ using System.Linq; using Moq; using Prism.Ioc; +using Prism.Navigation; using Prism.Regions; using Prism.Regions.Navigation; using Xamarin.Forms; @@ -41,7 +42,7 @@ public void WhenNavigating_ViewIsActivated() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -77,7 +78,7 @@ public void WhenNavigatingWithQueryString_ViewIsActivated() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -102,7 +103,7 @@ public void WhenNavigatingAndViewCannotBeAcquired_ThenNavigationResultHasError() IContainerExtension container = containerMock.Object; var targetHandlerMock = new Mock(); - targetHandlerMock.Setup(th => th.LoadContent(It.IsAny(), It.IsAny())).Throws(); + targetHandlerMock.Setup(th => th.LoadContent(It.IsAny(), It.IsAny())).Throws(); IRegionNavigationJournal journal = Mock.Of(); @@ -117,7 +118,7 @@ public void WhenNavigatingAndViewCannotBeAcquired_ThenNavigationResultHasError() new Uri(otherType.GetType().Name, UriKind.Relative), nr => { - error = nr.Error; + error = nr.Exception; }); // Verify @@ -145,13 +146,13 @@ public void WhenNavigatingWithNullUri_Throws() }; // Act - IRegionNavigationResult navigationResult = null; + NavigationResult navigationResult = null; target.RequestNavigate((Uri)null, nr => navigationResult = nr); // Verify - Assert.False(navigationResult.Result.Value); - Assert.NotNull(navigationResult.Error); - Assert.IsType(navigationResult.Error); + Assert.False(navigationResult.Success); + Assert.NotNull(navigationResult.Exception); + Assert.IsType(navigationResult.Exception); } [Fact] @@ -163,7 +164,7 @@ public void WhenNavigatingAndViewImplementsIRegionAware_ThenNavigatedIsInvokedOn var viewMock = new Mock(); viewMock .As() - .Setup(ina => ina.IsNavigationTarget(It.IsAny())) + .Setup(ina => ina.IsNavigationTarget(It.IsAny())) .Returns(true); var view = viewMock.Object; region.Add(view); @@ -188,7 +189,7 @@ public void WhenNavigatingAndViewImplementsIRegionAware_ThenNavigatedIsInvokedOn // Verify viewMock .As() - .Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri && nc.NavigationService == target))); + .Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri && nc.NavigationService == target))); } [Fact] @@ -200,7 +201,7 @@ public void WhenNavigatingAndBindingContextImplementsIRegionAware_ThenNavigatedI var mockView = new Mock(); var mockIRegionAwareBindingContext = new Mock(); mockIRegionAwareBindingContext - .Setup(ina => ina.IsNavigationTarget(It.IsAny())) + .Setup(ina => ina.IsNavigationTarget(It.IsAny())) .Returns(true); mockView.Object.BindingContext = mockIRegionAwareBindingContext.Object; @@ -225,7 +226,7 @@ public void WhenNavigatingAndBindingContextImplementsIRegionAware_ThenNavigatedI target.RequestNavigate(navigationUri, nr => { }); // Verify - mockIRegionAwareBindingContext.Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri))); + mockIRegionAwareBindingContext.Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri))); } [Fact] @@ -237,11 +238,11 @@ public void WhenNavigatingAndBothViewAndBindingContextImplementIRegionAware_Then var mockView = new Mock(); var mockIRegionAwareView = mockView.As(); mockIRegionAwareView - .Setup(ina => ina.IsNavigationTarget(It.IsAny())) + .Setup(ina => ina.IsNavigationTarget(It.IsAny())) .Returns(true); var mockIRegionAwareBindingContext = new Mock(); - mockIRegionAwareBindingContext.Setup(ina => ina.IsNavigationTarget(It.IsAny())).Returns(true); + mockIRegionAwareBindingContext.Setup(ina => ina.IsNavigationTarget(It.IsAny())).Returns(true); mockView.Object.BindingContext = mockIRegionAwareBindingContext.Object; var view = mockView.Object; @@ -265,8 +266,8 @@ public void WhenNavigatingAndBothViewAndBindingContextImplementIRegionAware_Then target.RequestNavigate(navigationUri, nr => { }); // Verify - mockIRegionAwareView.Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri))); - mockIRegionAwareBindingContext.Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri))); + mockIRegionAwareView.Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri))); + mockIRegionAwareBindingContext.Verify(v => v.OnNavigatedTo(It.Is(nc => nc.Uri == navigationUri))); } [Fact] @@ -319,8 +320,8 @@ public void WhenNavigatingAndCurrentlyActiveViewImplementsINavigateWithVeto_Then var viewMock = new Mock(); viewMock - .As() - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .As() + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) .Verifiable(); var view = viewMock.Object; @@ -356,9 +357,9 @@ public void WhenNavigating_ThenNavigationRequestQueriesForVetoOnAllActiveViewsIf var view1Mock = new Mock(); view1Mock - .As() - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(true)) + .As() + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(true)) .Verifiable(); var view1 = view1Mock.Object; @@ -366,7 +367,7 @@ public void WhenNavigating_ThenNavigationRequestQueriesForVetoOnAllActiveViewsIf region.Activate(view1); var view2Mock = new Mock(); - view2Mock.As(); + view2Mock.As(); var view2 = view2Mock.Object; region.Add(view2); @@ -380,9 +381,9 @@ public void WhenNavigating_ThenNavigationRequestQueriesForVetoOnAllActiveViewsIf var view4Mock = new Mock(); view4Mock - .As() - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(true)) + .As() + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(true)) .Verifiable(); var view4 = view4Mock.Object; @@ -409,8 +410,8 @@ public void WhenNavigating_ThenNavigationRequestQueriesForVetoOnAllActiveViewsIf // Verify view1Mock.VerifyAll(); view2Mock - .As() - .Verify(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>()), Times.Never()); + .As() + .Verify(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>()), Times.Never()); view3Mock.VerifyAll(); view4Mock.VerifyAll(); } @@ -423,9 +424,9 @@ public void WhenRequestNavigateAwayAcceptsThroughCallback_ThenNavigationProceeds var view1Mock = new Mock(); view1Mock - .As() - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(true)) + .As() + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(true)) .Verifiable(); var view1 = view1Mock.Object; @@ -453,7 +454,7 @@ public void WhenRequestNavigateAwayAcceptsThroughCallback_ThenNavigationProceeds // Act var navigationSucceeded = false; - target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Result == true; }); + target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Success == true; }); // Verify view1Mock.VerifyAll(); @@ -469,9 +470,9 @@ public void WhenRequestNavigateAwayRejectsThroughCallback_ThenNavigationDoesNotP var view1Mock = new Mock(); view1Mock - .As() - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(false)) + .As() + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(false)) .Verifiable(); var view1 = view1Mock.Object; @@ -499,7 +500,7 @@ public void WhenRequestNavigateAwayRejectsThroughCallback_ThenNavigationDoesNotP // Act var navigationFailed = false; - target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Result == false; }); + target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Success == false; }); // Verify view1Mock.VerifyAll(); @@ -513,9 +514,9 @@ public void WhenNavigatingAndBindingContextOnCurrentlyActiveViewImplementsINavig // Prepare var region = new Region(); - var viewModelMock = new Mock(); + var viewModelMock = new Mock(); viewModelMock - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) .Verifiable(); var viewMock = new Mock(); @@ -553,10 +554,10 @@ public void WhenRequestNavigateAwayOnBindingContextAcceptsThroughCallback_ThenNa // Prepare var region = new Region(); - var view1BindingContextMock = new Mock(); + var view1BindingContextMock = new Mock(); view1BindingContextMock - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(true)) + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(true)) .Verifiable(); var view1Mock = new Mock(); @@ -586,7 +587,7 @@ public void WhenRequestNavigateAwayOnBindingContextAcceptsThroughCallback_ThenNa // Act var navigationSucceeded = false; - target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Result == true; }); + target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Success == true; }); // Verify view1BindingContextMock.VerifyAll(); @@ -600,10 +601,10 @@ public void WhenRequestNavigateAwayOnBindingContextRejectsThroughCallback_ThenNa // Prepare var region = new Region(); - var view1BindingContextMock = new Mock(); + var view1BindingContextMock = new Mock(); view1BindingContextMock - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(false)) + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(false)) .Verifiable(); var view1Mock = new Mock(); @@ -633,7 +634,7 @@ public void WhenRequestNavigateAwayOnBindingContextRejectsThroughCallback_ThenNa // Act var navigationFailed = false; - target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Result == false; }); + target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Success == false; }); // Verify view1BindingContextMock.VerifyAll(); @@ -651,9 +652,9 @@ public void WhenViewAcceptsNavigationOutAfterNewIncomingRequestIsReceived_ThenOr var confirmationRequests = new List>(); viewMock - .As() - .Setup(icnr => icnr.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => { confirmationRequests.Add(c); }); + .As() + .Setup(icnr => icnr.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => { confirmationRequests.Add(c); }); var view = viewMock.Object; region.Add(view); @@ -668,7 +669,7 @@ public void WhenViewAcceptsNavigationOutAfterNewIncomingRequestIsReceived_ThenOr var contentLoaderMock = new Mock(); contentLoaderMock - .Setup(cl => cl.LoadContent(region, It.IsAny())) + .Setup(cl => cl.LoadContent(region, It.IsAny())) .Returns(view); var container = containerMock.Object; @@ -682,8 +683,8 @@ public void WhenViewAcceptsNavigationOutAfterNewIncomingRequestIsReceived_ThenOr bool firstNavigation = false; bool secondNavigation = false; - target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Result.Value); - target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Result.Value); + target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Success); + target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Success); Assert.Equal(2, confirmationRequests.Count); @@ -699,7 +700,7 @@ public void WhenViewModelAcceptsNavigationOutAfterNewIncomingRequestIsReceived_T { var region = new Region(); - var viewModelMock = new Mock(); + var viewModelMock = new Mock(); var viewMock = new Mock(); var view = viewMock.Object; @@ -708,8 +709,8 @@ public void WhenViewModelAcceptsNavigationOutAfterNewIncomingRequestIsReceived_T var confirmationRequests = new List>(); viewModelMock - .Setup(icnr => icnr.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => { confirmationRequests.Add(c); }); + .Setup(icnr => icnr.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => { confirmationRequests.Add(c); }); region.Add(view); region.Activate(view); @@ -723,7 +724,7 @@ public void WhenViewModelAcceptsNavigationOutAfterNewIncomingRequestIsReceived_T var contentLoaderMock = new Mock(); contentLoaderMock - .Setup(cl => cl.LoadContent(region, It.IsAny())) + .Setup(cl => cl.LoadContent(region, It.IsAny())) .Returns(view); var container = containerMock.Object; @@ -735,8 +736,8 @@ public void WhenViewModelAcceptsNavigationOutAfterNewIncomingRequestIsReceived_T Region = region }; - IRegionNavigationResult firstNavigation = null; - IRegionNavigationResult secondNavigation = null; + NavigationResult firstNavigation = null; + NavigationResult secondNavigation = null; target.RequestNavigate(navigationUri, nr => firstNavigation = nr); target.RequestNavigate(navigationUri, nr => secondNavigation = nr); @@ -745,8 +746,8 @@ public void WhenViewModelAcceptsNavigationOutAfterNewIncomingRequestIsReceived_T confirmationRequests[0](true); confirmationRequests[1](true); - Assert.False(firstNavigation.Result); - Assert.True(secondNavigation.Result.Value); + Assert.False(firstNavigation.Success); + Assert.True(secondNavigation.Success); } [Fact] @@ -786,7 +787,7 @@ public void BeforeNavigating_NavigatingEventIsRaised() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -830,7 +831,7 @@ public void WhenNavigationSucceeds_NavigatedIsRaised() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -845,7 +846,7 @@ public void WhenTargetViewCreationThrowsWithAsyncConfirmation_ThenExceptionIsPro var targetException = new Exception(); var targetHandlerMock = new Mock(); targetHandlerMock - .Setup(th => th.LoadContent(It.IsAny(), It.IsAny())) + .Setup(th => th.LoadContent(It.IsAny(), It.IsAny())) .Throws(targetException); var journalMock = new Mock(); @@ -853,9 +854,9 @@ public void WhenTargetViewCreationThrowsWithAsyncConfirmation_ThenExceptionIsPro Action navigationCallback = null; var viewMock = new Mock(); viewMock - .As() - .Setup(v => v.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => { navigationCallback = c; }); + .As() + .Setup(v => v.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => { navigationCallback = c; }); var region = new Region(); region.Add(viewMock.Object); @@ -866,12 +867,12 @@ public void WhenTargetViewCreationThrowsWithAsyncConfirmation_ThenExceptionIsPro Region = region }; - IRegionNavigationResult result = null; + NavigationResult result = null; target.RequestNavigate(new Uri("", UriKind.Relative), nr => result = nr); navigationCallback(true); Assert.NotNull(result); - Assert.Same(targetException, result.Error); + Assert.Same(targetException, result.Exception); } [Fact] @@ -908,7 +909,7 @@ public void WhenNavigatingFromViewThatIsNavigationAware_ThenNotifiesActiveViewNa // Verify viewMock.As() - .Verify(v => v.OnNavigatedFrom(It.Is(ctx => ctx.Uri == navigationUri && ctx.Parameters.Count() == 0))); + .Verify(v => v.OnNavigatedFrom(It.Is(ctx => ctx.Uri == navigationUri && ctx.Parameters.Count() == 0))); } [Fact] @@ -923,7 +924,7 @@ public void WhenNavigationFromViewThatIsNavigationAware_OnlyNotifiesOnNavigateFr var viewMock = new Mock(); viewMock .As() - .Setup(x => x.OnNavigatedFrom(It.IsAny())).Callback(() => navigationFromInvoked = true); + .Setup(x => x.OnNavigatedFrom(It.IsAny())).Callback(() => navigationFromInvoked = true); var view = viewMock.Object; region.Add(view); @@ -958,7 +959,7 @@ public void WhenNavigationFromViewThatIsNavigationAware_OnlyNotifiesOnNavigateFr } [Fact] - public void WhenNavigatingFromActiveViewWithNavigatinAwareDataConext_NotifiesContextOfNavigatingFrom() + public void WhenNavigatingFromActiveViewWithNavigationAwareDataContext_NotifiesContextOfNavigatingFrom() { // Arrange var region = new Region(); @@ -993,7 +994,7 @@ public void WhenNavigatingFromActiveViewWithNavigatinAwareDataConext_NotifiesCon target.RequestNavigate(navigationUri, nr => { }); // Verify - mockBindingContext.Verify(v => v.OnNavigatedFrom(It.Is(ctx => ctx.Uri == navigationUri && ctx.Parameters.Count() == 0))); + mockBindingContext.Verify(v => v.OnNavigatedFrom(It.Is(ctx => ctx.Uri == navigationUri && ctx.Parameters.Count() == 0))); } [Fact] @@ -1014,7 +1015,7 @@ public void WhenNavigatingWithNullCallback_ThenThrows() ExceptionAssert.Throws( () => { - target.RequestNavigate(navigationUri, null); + target.RequestNavigate(navigationUri); }); } @@ -1029,7 +1030,7 @@ public void WhenNavigatingWithNoRegionSet_ThenMarshallExceptionToCallback() var target = new RegionNavigationService(container, contentLoader, journal); Exception error = null; - target.RequestNavigate(navigationUri, nr => error = nr.Error); + target.RequestNavigate(navigationUri, nr => error = nr.Exception); Assert.NotNull(error); Assert.IsType(error); @@ -1048,7 +1049,7 @@ public void WhenNavigatingWithNullUri_ThenMarshallExceptionToCallback() }; Exception error = null; - target.RequestNavigate(null, nr => error = nr.Error); + target.RequestNavigate("", nr => error = nr.Exception); Assert.NotNull(error); Assert.IsType(error); @@ -1066,7 +1067,7 @@ public void WhenNavigationFailsBecauseTheContentViewCannotBeRetrieved_ThenNaviga var contentLoaderMock = new Mock(); contentLoaderMock - .Setup(cl => cl.LoadContent(region, It.IsAny())) + .Setup(cl => cl.LoadContent(region, It.IsAny())) .Throws(); var container = containerMock.Object; @@ -1089,7 +1090,7 @@ public void WhenNavigationFailsBecauseTheContentViewCannotBeRetrieved_ThenNaviga // Act bool? isNavigationSuccessful = null; - target.RequestNavigate(new Uri("invalid", UriKind.Relative), nr => isNavigationSuccessful = nr.Result); + target.RequestNavigate(new Uri("invalid", UriKind.Relative), nr => isNavigationSuccessful = nr.Success); // Verify Assert.False(isNavigationSuccessful.Value); @@ -1105,9 +1106,9 @@ public void WhenNavigationFailsBecauseActiveViewRejectsIt_ThenNavigationFailedIs var view1Mock = new Mock(); view1Mock - .As() - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(false)) + .As() + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(false)) .Verifiable(); var view1 = view1Mock.Object; @@ -1126,7 +1127,7 @@ public void WhenNavigationFailsBecauseActiveViewRejectsIt_ThenNavigationFailedIs var contentLoaderMock = new Mock(); contentLoaderMock - .Setup(cl => cl.LoadContent(region, It.IsAny())) + .Setup(cl => cl.LoadContent(region, It.IsAny())) .Returns(view2); var container = containerMock.Object; @@ -1149,7 +1150,7 @@ public void WhenNavigationFailsBecauseActiveViewRejectsIt_ThenNavigationFailedIs // Act bool? isNavigationSuccessful = null; - target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Result); + target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Success); // Verify view1Mock.VerifyAll(); @@ -1164,10 +1165,10 @@ public void WhenNavigationFailsBecauseBindingContextForActiveViewRejectsIt_ThenN // Prepare var region = new Region { Name = "RegionName" }; - var viewModel1Mock = new Mock(); + var viewModel1Mock = new Mock(); viewModel1Mock - .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) - .Callback>((nc, c) => c(false)) + .Setup(ina => ina.ConfirmNavigationRequest(It.IsAny(), It.IsAny>())) + .Callback>((nc, c) => c(false)) .Verifiable(); var view1Mock = new Mock(); @@ -1188,7 +1189,7 @@ public void WhenNavigationFailsBecauseBindingContextForActiveViewRejectsIt_ThenN var contentLoaderMock = new Mock(); contentLoaderMock - .Setup(cl => cl.LoadContent(region, It.IsAny())) + .Setup(cl => cl.LoadContent(region, It.IsAny())) .Returns(view2); var container = containerMock.Object; @@ -1211,7 +1212,7 @@ public void WhenNavigationFailsBecauseBindingContextForActiveViewRejectsIt_ThenN // Act bool? isNavigationSuccessful = null; - target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Result); + target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Success); // Verify viewModel1Mock.VerifyAll(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs index e89ccc82a0..29042e43b8 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs @@ -44,7 +44,7 @@ public void ShouldRaiseEventWhenAddingContent() Assert.NotNull(listener.onViewRegisteredArguments); Assert.NotNull(listener.onViewRegisteredArguments.GetView); - var result = listener.onViewRegisteredArguments.GetView(); + var result = listener.onViewRegisteredArguments.GetView(containerMock.Object); Assert.NotNull(result); Assert.IsType(result); } diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs index c3c39dbd0d..83e8131804 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs @@ -101,7 +101,8 @@ public void RegionViewModel_HasPageAccessor_WithCorrectPage() var region = regionManager.Regions.First(x => x.Name == "ContentRegion"); var activeView = region.ActiveViews.First(); Assert.IsType(activeView); - var viewModel = activeView.BindingContext as MockRegionViewAViewModel; + var activeViewAsMockRegionViewA = activeView as MockRegionViewA; + var viewModel = activeViewAsMockRegionViewA.BindingContext as MockRegionViewAViewModel; Assert.NotNull(viewModel); Assert.NotNull(viewModel.Page); diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/ViewModels/MockRegionViewAViewModel.cs b/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/ViewModels/MockRegionViewAViewModel.cs index 740ac9bca5..a668082357 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/ViewModels/MockRegionViewAViewModel.cs +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/ViewModels/MockRegionViewAViewModel.cs @@ -29,17 +29,17 @@ public void Initialize(INavigationParameters parameters) Message = message; } - public bool IsNavigationTarget(INavigationContext navigationContext) + public bool IsNavigationTarget(NavigationContext navigationContext) { return navigationContext.NavigatedName() == "MockRegionViewA"; } - public void OnNavigatedFrom(INavigationContext navigationContext) + public void OnNavigatedFrom(NavigationContext navigationContext) { } - public void OnNavigatedTo(INavigationContext navigationContext) + public void OnNavigatedTo(NavigationContext navigationContext) { } diff --git a/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs b/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs index 22a1eac798..b31f8cf7b2 100644 --- a/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs +++ b/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs @@ -1,4 +1,5 @@ using System; +using Prism.Ioc; using Prism.Navigation; using Prism.Regions; @@ -89,5 +90,10 @@ public IRegionManager RegisterViewWithRegion(string regionName, string viewName) { throw new NotImplementedException(); } + + public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) + { + throw new NotImplementedException(); + } } } diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs index 49642ab471..838445b505 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs @@ -1,6 +1,7 @@ using System; using System.Collections; using System.Collections.Generic; +using Prism.Ioc; using Prism.Navigation; using Prism.Regions; @@ -37,7 +38,7 @@ public IRegionManager RegisterViewWithRegion(string regionName, Type viewType) throw new NotImplementedException(); } - public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) + public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) { throw new NotImplementedException(); } diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs index 4c4b5a13ba..a0903376ec 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; +using Prism.Ioc; using Prism.Regions; using Prism.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; @@ -94,7 +95,7 @@ private class MockRegionContentRegistry : IRegionViewRegistry public event EventHandler ContentRegistered; - public IEnumerable GetContents(string regionName) + public IEnumerable GetContents(string regionName, IContainerProvider container) { GetContentsCalled = true; this.GetContentsArgumentRegionName = regionName; @@ -103,7 +104,7 @@ public IEnumerable GetContents(string regionName) public void RaiseContentRegistered(string regionName, object view) { - this.ContentRegistered(this, new ViewRegisteredEventArgs(regionName, () => view)); + this.ContentRegistered(this, new ViewRegisteredEventArgs(regionName, _ => view)); } public void RegisterViewWithRegion(string regionName, Type viewType) @@ -111,7 +112,12 @@ public void RegisterViewWithRegion(string regionName, Type viewType) throw new NotImplementedException(); } - public void RegisterViewWithRegion(string regionName, Func getContentDelegate) + public void RegisterViewWithRegion(string regionName, Func getContentDelegate) + { + throw new NotImplementedException(); + } + + public void RegisterViewWithRegion(string regionName, string targetName) { throw new NotImplementedException(); } diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs index 326948ef33..6635b65cc0 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.Threading.Tasks; using System.Windows.Controls; +using Prism.Ioc; using Prism.Navigation; using Prism.Regions; using Prism.Regions.Behaviors; @@ -242,7 +243,7 @@ public IRegionManager RegisterViewWithRegion(string regionName, Type viewType) throw new NotImplementedException(); } - public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) + public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) { throw new NotImplementedException(); } diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs index 2b9c178346..dcdcc71a88 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs @@ -2,6 +2,7 @@ using System; using Moq; +using Prism.Navigation; using Prism.Regions; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs index 3ff8bfbbc3..a3f01dc1a6 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs @@ -471,7 +471,7 @@ public IRegionManager RegisterViewWithRegion(string regionName, Type viewType) throw new NotImplementedException(); } - public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) + public IRegionManager RegisterViewWithRegion(string regionName, Func getContentDelegate) { throw new NotImplementedException(); } diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs index 458ced8231..0c67c26307 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs @@ -408,9 +408,9 @@ public void CanRegisterDelegate() var mockRegionContentRegistry = new MockRegionContentRegistry(); string regionName = null; - Func contentDelegate = null; + Func contentDelegate = null; - Func expectedDelegate = () => true; + Func expectedDelegate = _ => true; mockRegionContentRegistry.RegisterContentWithDelegate = (name, usedDelegate) => { regionName = name; @@ -474,19 +474,24 @@ public FrameworkException(Exception inner) internal class MockRegionContentRegistry : IRegionViewRegistry { public Func RegisterContentWithViewType; - public Func, object> RegisterContentWithDelegate; + public Func, object> RegisterContentWithDelegate; public event EventHandler ContentRegistered; - public IEnumerable GetContents(string regionName) + public IEnumerable GetContents(string regionName, IContainerProvider container) { return null; } + public void RegisterViewWithRegion(string regionName, string targetName) + { + throw new NotImplementedException(); + } + void IRegionViewRegistry.RegisterViewWithRegion(string regionName, Type viewType) { RegisterContentWithViewType?.Invoke(regionName, viewType); } - void IRegionViewRegistry.RegisterViewWithRegion(string regionName, Func getContentDelegate) + void IRegionViewRegistry.RegisterViewWithRegion(string regionName, Func getContentDelegate) { RegisterContentWithDelegate?.Invoke(regionName, getContentDelegate); diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs index fc04ce9f10..7c86855dfb 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs @@ -56,19 +56,19 @@ public void WhenNonExistentRegion_ReturnNavigationResultFalse() result = null; regionManager.RequestNavigate(nonExistentRegion, source, (r) => result = r, parameters); - Assert.Equal(false, result.Result); + Assert.False(result.Success); result = null; regionManager.RequestNavigate(nonExistentRegion, source, (r) => result = r); - Assert.Equal(false, result.Result); + Assert.False(result.Success); result = null; regionManager.RequestNavigate(nonExistentRegion, sourceUri, (r) => result = r, parameters); - Assert.Equal(false, result.Result); + Assert.False(result.Success); result = null; regionManager.RequestNavigate(nonExistentRegion, sourceUri, (r) => result = r); - Assert.Equal(false, result.Result); + Assert.False(result.Success); } [Fact] diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs index b8a49110c0..862a09dcd2 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs @@ -4,6 +4,7 @@ using System.Windows; using Moq; using Prism.Ioc; +using Prism.Navigation; using Prism.Regions; using Xunit; @@ -40,7 +41,7 @@ public void WhenNavigating_ViewIsActivated() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -76,7 +77,7 @@ public void WhenNavigatingWithQueryString_ViewIsActivated() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -116,7 +117,7 @@ public void WhenNavigatingAndViewCannotBeAcquired_ThenNavigationResultHasError() new Uri(otherType.GetType().Name, UriKind.Relative), nr => { - error = nr.Error; + error = nr.Exception; }); // Verify @@ -148,9 +149,9 @@ public void WhenNavigatingWithNullUri_Throws() target.RequestNavigate((Uri)null, nr => navigationResult = nr); // Verify - Assert.False(navigationResult.Result.Value); - Assert.NotNull(navigationResult.Error); - Assert.IsType(navigationResult.Error); + Assert.False(navigationResult.Success); + Assert.NotNull(navigationResult.Exception); + Assert.IsType(navigationResult.Exception); } [Fact] @@ -435,7 +436,7 @@ public void WhenRequestNavigateAwayAcceptsThroughCallback_ThenNavigationProceeds // Act var navigationSucceeded = false; - target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Result == true; }); + target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Success == true; }); // Verify view1Mock.VerifyAll(); @@ -480,7 +481,7 @@ public void WhenRequestNavigateAwayRejectsThroughCallback_ThenNavigationDoesNotP // Act var navigationFailed = false; - target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Result == false; }); + target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Success == false; }); // Verify view1Mock.VerifyAll(); @@ -567,7 +568,7 @@ public void WhenRequestNavigateAwayOnDataContextAcceptsThroughCallback_ThenNavig // Act var navigationSucceeded = false; - target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Result == true; }); + target.RequestNavigate(navigationUri, nr => { navigationSucceeded = nr.Success == true; }); // Verify view1DataContextMock.VerifyAll(); @@ -614,7 +615,7 @@ public void WhenRequestNavigateAwayOnDataContextRejectsThroughCallback_ThenNavig // Act var navigationFailed = false; - target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Result == false; }); + target.RequestNavigate(navigationUri, nr => { navigationFailed = nr.Success == false; }); // Verify view1DataContextMock.VerifyAll(); @@ -662,8 +663,8 @@ public void WhenViewAcceptsNavigationOutAfterNewIncomingRequestIsReceived_ThenOr bool firstNavigation = false; bool secondNavigation = false; - target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Result.Value); - target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Result.Value); + target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Success); + target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Success); Assert.Equal(2, confirmationRequests.Count); @@ -717,8 +718,8 @@ public void WhenViewModelAcceptsNavigationOutAfterNewIncomingRequestIsReceived_T bool firstNavigation = false; bool secondNavigation = false; - target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Result.Value); - target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Result.Value); + target.RequestNavigate(navigationUri, nr => firstNavigation = nr.Success); + target.RequestNavigate(navigationUri, nr => secondNavigation = nr.Success); Assert.Equal(2, confirmationRequests.Count); @@ -766,7 +767,7 @@ public void BeforeNavigating_NavigatingEventIsRaised() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -810,7 +811,7 @@ public void WhenNavigationSucceeds_NavigatedIsRaised() // Act bool isNavigationSuccessful = false; - target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Result == true); + target.RequestNavigate(viewUri, nr => isNavigationSuccessful = nr.Success == true); // Verify Assert.True(isNavigationSuccessful); @@ -850,7 +851,7 @@ public void WhenTargetViewCreationThrowsWithAsyncConfirmation_ThenExceptionIsPro navigationCallback(true); Assert.NotNull(result); - Assert.Same(targetException, result.Error); + Assert.Same(targetException, result.Exception); } [Fact] @@ -1002,7 +1003,7 @@ public void WhenNavigatingWithNoRegionSet_ThenMarshallExceptionToCallback() RegionNavigationService target = new RegionNavigationService(container, contentLoader, journal); Exception error = null; - target.RequestNavigate(navigationUri, nr => error = nr.Error); + target.RequestNavigate(navigationUri, nr => error = nr.Exception); Assert.NotNull(error); Assert.IsType(error); @@ -1021,7 +1022,7 @@ public void WhenNavigatingWithNullUri_ThenMarshallExceptionToCallback() }; Exception error = null; - target.RequestNavigate(null, nr => error = nr.Error); + target.RequestNavigate(null, nr => error = nr.Exception); Assert.NotNull(error); Assert.IsType(error); @@ -1062,7 +1063,7 @@ public void WhenNavigationFailsBecauseTheContentViewCannotBeRetrieved_ThenNaviga // Act bool? isNavigationSuccessful = null; - target.RequestNavigate(new Uri("invalid", UriKind.Relative), nr => isNavigationSuccessful = nr.Result); + target.RequestNavigate(new Uri("invalid", UriKind.Relative), nr => isNavigationSuccessful = nr.Success); // Verify Assert.False(isNavigationSuccessful.Value); @@ -1121,7 +1122,7 @@ public void WhenNavigationFailsBecauseActiveViewRejectsIt_ThenNavigationFailedIs // Act bool? isNavigationSuccessful = null; - target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Result); + target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Success); // Verify view1Mock.VerifyAll(); @@ -1183,7 +1184,7 @@ public void WhenNavigationFailsBecauseDataContextForActiveViewRejectsIt_ThenNavi // Act bool? isNavigationSuccessful = null; - target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Result); + target.RequestNavigate(navigationUri, nr => isNavigationSuccessful = nr.Success); // Verify viewModel1Mock.VerifyAll(); diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs index 2157a53d63..925e45b258 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs @@ -44,7 +44,7 @@ public void ShouldRaiseEventWhenAddingContent() Assert.NotNull(listener.onViewRegisteredArguments); Assert.NotNull(listener.onViewRegisteredArguments.GetView); - var result = listener.onViewRegisteredArguments.GetView(); + var result = listener.onViewRegisteredArguments.GetView(containerMock.Object); Assert.NotNull(result); Assert.IsType(result); } From e2010629f8f81d28b5b9231185ead0508cc58ee8 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 26 Aug 2023 14:50:30 -0600 Subject: [PATCH 05/19] chore: adding support for implicit namespace imports --- Directory.Build.props | 5 +++++ src/Maui/Prism.Maui/Prism.Maui.csproj | 1 - src/Maui/Prism.Maui/build/Package.targets | 7 +++++++ src/Maui/Prism.Maui/build/Prism.Maui.targets | 17 ----------------- .../build/Package.props} | 7 ++++--- ...Prism.DryIoc.Uno.targets => Package.targets} | 0 src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj | 1 - 7 files changed, 16 insertions(+), 22 deletions(-) create mode 100644 src/Maui/Prism.Maui/build/Package.targets delete mode 100644 src/Maui/Prism.Maui/build/Prism.Maui.targets rename src/{Uno/Prism.Uno/build/Prism.Uno.WinUI.targets => Prism.Core/build/Package.props} (89%) rename src/Uno/Prism.DryIoc.Uno/build/{Prism.DryIoc.Uno.targets => Package.targets} (100%) diff --git a/Directory.Build.props b/Directory.Build.props index 46aa7f4b4d..9dc72fea5a 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -95,6 +95,11 @@ + + + + + diff --git a/src/Maui/Prism.Maui/Prism.Maui.csproj b/src/Maui/Prism.Maui/Prism.Maui.csproj index 1e5b20ded5..bc9b7536c3 100644 --- a/src/Maui/Prism.Maui/Prism.Maui.csproj +++ b/src/Maui/Prism.Maui/Prism.Maui.csproj @@ -21,7 +21,6 @@ - True True diff --git a/src/Maui/Prism.Maui/build/Package.targets b/src/Maui/Prism.Maui/build/Package.targets new file mode 100644 index 0000000000..5619b83c28 --- /dev/null +++ b/src/Maui/Prism.Maui/build/Package.targets @@ -0,0 +1,7 @@ + + + + + + + diff --git a/src/Maui/Prism.Maui/build/Prism.Maui.targets b/src/Maui/Prism.Maui/build/Prism.Maui.targets deleted file mode 100644 index 20a6b2ff5a..0000000000 --- a/src/Maui/Prism.Maui/build/Prism.Maui.targets +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - - diff --git a/src/Uno/Prism.Uno/build/Prism.Uno.WinUI.targets b/src/Prism.Core/build/Package.props similarity index 89% rename from src/Uno/Prism.Uno/build/Prism.Uno.WinUI.targets rename to src/Prism.Core/build/Package.props index c600067cdd..5fd315f148 100644 --- a/src/Uno/Prism.Uno/build/Prism.Uno.WinUI.targets +++ b/src/Prism.Core/build/Package.props @@ -1,13 +1,14 @@ - + + + - + - diff --git a/src/Uno/Prism.DryIoc.Uno/build/Prism.DryIoc.Uno.targets b/src/Uno/Prism.DryIoc.Uno/build/Package.targets similarity index 100% rename from src/Uno/Prism.DryIoc.Uno/build/Prism.DryIoc.Uno.targets rename to src/Uno/Prism.DryIoc.Uno/build/Package.targets diff --git a/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj b/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj index 665ba1ac20..dffe8ac177 100644 --- a/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj +++ b/src/Uno/Prism.Uno/Prism.Uno.WinUI.csproj @@ -21,7 +21,6 @@ - From d1c7ec5a3469eed4993cb2f9c8556caa5d64e3b2 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 26 Aug 2023 16:04:22 -0600 Subject: [PATCH 06/19] chore: update targets reference --- e2e/Maui/Directory.Build.targets | 2 +- tests/Maui/Directory.Build.targets | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/e2e/Maui/Directory.Build.targets b/e2e/Maui/Directory.Build.targets index d6f56d74f7..a90eda7e57 100644 --- a/e2e/Maui/Directory.Build.targets +++ b/e2e/Maui/Directory.Build.targets @@ -1,3 +1,3 @@ - + diff --git a/tests/Maui/Directory.Build.targets b/tests/Maui/Directory.Build.targets index 2d1101238f..bd3b1e317e 100644 --- a/tests/Maui/Directory.Build.targets +++ b/tests/Maui/Directory.Build.targets @@ -1,5 +1,5 @@ - + From 021eff78b8a2a12b6f27f215ff319d8b0dfeb13e Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sun, 27 Aug 2023 09:08:24 -0600 Subject: [PATCH 07/19] chore: adding targets to e2e apps --- e2e/Maui/Directory.Build.targets | 1 + e2e/Uno/Directory.Build.targets | 1 + src/Prism.Core/build/{Package.props => Package.targets} | 0 3 files changed, 2 insertions(+) rename src/Prism.Core/build/{Package.props => Package.targets} (100%) diff --git a/e2e/Maui/Directory.Build.targets b/e2e/Maui/Directory.Build.targets index a90eda7e57..b3e1ad3ae4 100644 --- a/e2e/Maui/Directory.Build.targets +++ b/e2e/Maui/Directory.Build.targets @@ -1,3 +1,4 @@ + diff --git a/e2e/Uno/Directory.Build.targets b/e2e/Uno/Directory.Build.targets index b0c04079aa..38c7058ee1 100644 --- a/e2e/Uno/Directory.Build.targets +++ b/e2e/Uno/Directory.Build.targets @@ -1,3 +1,4 @@ + diff --git a/src/Prism.Core/build/Package.props b/src/Prism.Core/build/Package.targets similarity index 100% rename from src/Prism.Core/build/Package.props rename to src/Prism.Core/build/Package.targets From 77301321bc9c5da40361ef8a688f1315fe5a6383 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 2 Sep 2023 11:05:06 -0600 Subject: [PATCH 08/19] chore: adding Prism.Core implicit namespaces for tests --- tests/Maui/Directory.Build.targets | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Maui/Directory.Build.targets b/tests/Maui/Directory.Build.targets index bd3b1e317e..b40b386088 100644 --- a/tests/Maui/Directory.Build.targets +++ b/tests/Maui/Directory.Build.targets @@ -1,4 +1,5 @@ + From fe330993f8638c4e628c726424f6431eb48faa82 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 2 Sep 2023 11:10:13 -0600 Subject: [PATCH 09/19] chore: uno package update --- Directory.Packages.props | 33 ++++++++++++++++----------------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/Directory.Packages.props b/Directory.Packages.props index 2ea1b222d7..c1b4283eda 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -7,7 +7,6 @@ - @@ -15,15 +14,15 @@ - - - - - - - - - + + + + + + + + + @@ -31,19 +30,19 @@ - + - - - + + + - + - - + + From 8db24e15faf335bd2b7e8357ae89adccfbc02b58 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 2 Sep 2023 17:10:48 -0600 Subject: [PATCH 10/19] chore: adding back in missing API from migration --- .../Prism.Forms.Regions/Regions/Region.cs | 9 ++++ src/Maui/Prism.Maui/Regions/Region.cs | 2 +- src/Prism.Core/Regions/IRegion.cs | 8 ++++ .../RegionCreationException.Desktop.cs | 24 ---------- .../Behaviors/RegionCreationException.cs | 40 ---------------- src/Wpf/Prism.Wpf/Regions/Region.cs | 48 ++++++++++++------- .../Mocks/MockPresentationRegion.cs | 3 ++ .../Mocks/MockRegion.cs | 2 + .../Mocks/MockPresentationRegion.cs | 3 ++ tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs | 2 + 10 files changed, 59 insertions(+), 82 deletions(-) delete mode 100644 src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.Desktop.cs delete mode 100644 src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.cs diff --git a/src/Forms/Prism.Forms.Regions/Regions/Region.cs b/src/Forms/Prism.Forms.Regions/Regions/Region.cs index 79fec8b92d..9884703466 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Region.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Region.cs @@ -229,6 +229,15 @@ public virtual void Deactivate(object view) } } + /// + /// Add a View by name. + /// + /// + /// + /// Xamarin.Forms is in maintenance mode. This feature is not being supported. + /// + public IRegionManager Add(string viewName) => throw new NotImplementedException(); + /// Adds a new view to the region. /// /// Adds a new view to the region. diff --git a/src/Maui/Prism.Maui/Regions/Region.cs b/src/Maui/Prism.Maui/Regions/Region.cs index cee2644137..983cd87afc 100644 --- a/src/Maui/Prism.Maui/Regions/Region.cs +++ b/src/Maui/Prism.Maui/Regions/Region.cs @@ -265,7 +265,7 @@ private void InnerAdd(object view, string viewName, IRegionManager scopedRegionM { if (view is not VisualElement visualElement) { - throw new Exception("The view must inherit from VisualElement."); + throw new UpdateRegionsException("The view must inherit from VisualElement."); } if (ItemMetadataCollection.FirstOrDefault(x => x.Item == view) != null) diff --git a/src/Prism.Core/Regions/IRegion.cs b/src/Prism.Core/Regions/IRegion.cs index d8b13e7fc6..205a743279 100644 --- a/src/Prism.Core/Regions/IRegion.cs +++ b/src/Prism.Core/Regions/IRegion.cs @@ -38,6 +38,14 @@ public interface IRegion : INavigateAsync, INotifyPropertyChanged /// The comparison to use. Comparison SortComparison { get; set; } + ///Adds a new view to the region. + /// + /// Adds a new view to the region. + /// + /// The view to add. + /// The that is set on the view. It will be the current region manager when using this overload. + IRegionManager Add(string viewName); + ///Adds a new view to the region. /// /// Adds a new view to the region. diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.Desktop.cs b/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.Desktop.cs deleted file mode 100644 index ca93f5d4f2..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.Desktop.cs +++ /dev/null @@ -1,24 +0,0 @@ - - -using System; -using System.Runtime.Serialization; - -namespace Prism.Regions.Behaviors -{ - /// - /// - /// - [Serializable] - public partial class RegionCreationException - { - /// - /// Initializes a new instance of the class with serialized data. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. - protected RegionCreationException(SerializationInfo info, StreamingContext context) - : base(info, context) - { - } - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.cs b/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.cs deleted file mode 100644 index 759b5e833f..0000000000 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionCreationException.cs +++ /dev/null @@ -1,40 +0,0 @@ - - -using System; - -namespace Prism.Regions.Behaviors -{ - /// - /// Represents errors that occured during region creation. - /// - public partial class RegionCreationException : Exception - { - /// - /// Initializes a new instance of the - /// - public RegionCreationException() - { - } - - /// - /// Initializes a new instance of the class with a specified error message. - /// - /// The message that describes the error. - public RegionCreationException(string message) - : base(message) - { - } - - /// - /// Initializes a new instance of the class with a specified error message and a reference - /// to the inner exception that is the cause of this exception. - /// - /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference - /// (Nothing in Visual Basic) if no inner exception is specified. - public RegionCreationException(string message, Exception inner) - : base(message, inner) - { - } - } -} diff --git a/src/Wpf/Prism.Wpf/Regions/Region.cs b/src/Wpf/Prism.Wpf/Regions/Region.cs index ce84324750..d033c219b0 100644 --- a/src/Wpf/Prism.Wpf/Regions/Region.cs +++ b/src/Wpf/Prism.Wpf/Regions/Region.cs @@ -32,6 +32,7 @@ public class Region : IRegion private object _context; private IRegionManager _regionManager; private IRegionNavigationService _regionNavigationService; + private IContainerProvider _container; private Comparison _sort; @@ -41,6 +42,7 @@ public class Region : IRegion public Region() { Behaviors = new RegionBehaviorCollection(this); + _container = ContainerLocator.Container; _sort = DefaultSortComparison; } @@ -226,6 +228,18 @@ protected virtual ObservableCollection ItemMetadataCollection } } + /// Adds a new view to the region. + /// + /// Adds a new view to the region. + /// + /// The view to add. + /// The that is set on the view if it is a . It will be the current region manager when using this overload. + public IRegionManager Add(string viewName) + { + var view = _container.Resolve(viewName); + return Add(view, viewName, false); + } + /// Adds a new view to the region. /// /// Adds a new view to the region. @@ -234,7 +248,7 @@ protected virtual ObservableCollection ItemMetadataCollection /// The that is set on the view if it is a . It will be the current region manager when using this overload. public IRegionManager Add(object view) { - return this.Add(view, null, false); + return Add(view, null, false); } /// @@ -250,7 +264,7 @@ public IRegionManager Add(object view, string viewName) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.StringCannotBeNullOrEmpty, "viewName")); } - return this.Add(view, viewName, false); + return Add(view, viewName, false); } /// @@ -262,8 +276,8 @@ public IRegionManager Add(object view, string viewName) /// The that is set on the view if it is a . public virtual IRegionManager Add(object view, string viewName, bool createRegionManagerScope) { - IRegionManager manager = createRegionManagerScope ? this.RegionManager.CreateRegionManager() : this.RegionManager; - this.InnerAdd(view, viewName, manager); + IRegionManager manager = createRegionManagerScope ? RegionManager.CreateRegionManager() : RegionManager; + InnerAdd(view, viewName, manager); return manager; } @@ -273,11 +287,11 @@ public virtual IRegionManager Add(object view, string viewName, bool createRegio /// The view to remove. public virtual void Remove(object view) { - ItemMetadata itemMetadata = this.GetItemMetadataOrThrow(view); + ItemMetadata itemMetadata = GetItemMetadataOrThrow(view); ItemMetadataCollection.Remove(itemMetadata); - if (view is DependencyObject dependencyObject && Regions.RegionManager.GetRegionManager(dependencyObject) == this.RegionManager) + if (view is DependencyObject dependencyObject && Regions.RegionManager.GetRegionManager(dependencyObject) == RegionManager) { dependencyObject.ClearValue(Regions.RegionManager.RegionManagerProperty); } @@ -300,7 +314,7 @@ public void RemoveAll() /// The view to activate. public virtual void Activate(object view) { - ItemMetadata itemMetadata = this.GetItemMetadataOrThrow(view); + ItemMetadata itemMetadata = GetItemMetadataOrThrow(view); if (!itemMetadata.IsActive) { @@ -314,7 +328,7 @@ public virtual void Activate(object view) /// The view to deactivate. public virtual void Deactivate(object view) { - ItemMetadata itemMetadata = this.GetItemMetadataOrThrow(view); + ItemMetadata itemMetadata = GetItemMetadataOrThrow(view); if (itemMetadata.IsActive) { @@ -334,7 +348,7 @@ public virtual object GetView(string viewName) throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, Resources.StringCannotBeNullOrEmpty, "viewName")); } - ItemMetadata metadata = this.ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName); + ItemMetadata metadata = ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName); if (metadata != null) { @@ -351,7 +365,7 @@ public virtual object GetView(string viewName) /// A callback to execute when the navigation request is completed. public void RequestNavigate(Uri target, Action navigationCallback) { - this.RequestNavigate(target, navigationCallback, null); + RequestNavigate(target, navigationCallback, null); } /// @@ -362,22 +376,22 @@ public void RequestNavigate(Uri target, Action navigationCallb /// The navigation parameters specific to the navigation request. public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) { - this.NavigationService.RequestNavigate(target, navigationCallback, navigationParameters); + NavigationService.RequestNavigate(target, navigationCallback, navigationParameters); } private void InnerAdd(object view, string viewName, IRegionManager scopedRegionManager) { - if (this.ItemMetadataCollection.FirstOrDefault(x => x.Item == view) != null) + if (ItemMetadataCollection.FirstOrDefault(x => x.Item == view) != null) { throw new InvalidOperationException(Resources.RegionViewExistsException); } - ItemMetadata itemMetadata = new ItemMetadata(view); + var itemMetadata = new ItemMetadata(view); if (!string.IsNullOrEmpty(viewName)) { - if (this.ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName) != null) + if (ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName) != null) { - throw new InvalidOperationException(String.Format(CultureInfo.InvariantCulture, Resources.RegionViewNameExistsException, viewName)); + throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Resources.RegionViewNameExistsException, viewName)); } itemMetadata.Name = viewName; } @@ -388,7 +402,7 @@ private void InnerAdd(object view, string viewName, IRegionManager scopedRegionM Regions.RegionManager.SetRegionManager(dependencyObject, scopedRegionManager); } - this.ItemMetadataCollection.Add(itemMetadata); + ItemMetadataCollection.Add(itemMetadata); } private ItemMetadata GetItemMetadataOrThrow(object view) @@ -396,7 +410,7 @@ private ItemMetadata GetItemMetadataOrThrow(object view) if (view == null) throw new ArgumentNullException(nameof(view)); - ItemMetadata itemMetadata = this.ItemMetadataCollection.FirstOrDefault(x => x.Item == view); + ItemMetadata itemMetadata = ItemMetadataCollection.FirstOrDefault(x => x.Item == view); if (itemMetadata == null) throw new ArgumentException(Resources.ViewNotInRegionException, nameof(view)); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs index f9d068c32c..f325b0b6f3 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs @@ -17,6 +17,9 @@ public MockPresentationRegion() { Behaviors = new MockRegionBehaviorCollection(); } + + public IRegionManager Add(string viewName) => throw new NotImplementedException(); + public IRegionManager Add(object view) { MockViews.Items.Add(view); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs index 4dd6d763f4..f59d205eb3 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs @@ -33,6 +33,8 @@ public NavigationParameters NavigationParameters public string Name { get; set; } + public IRegionManager Add(string viewName) => throw new NotImplementedException(); + public IRegionManager Add(object view) { _views.Add(view); diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs index b770ada7db..ab63a17d33 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs @@ -14,6 +14,9 @@ public MockPresentationRegion() { Behaviors = new MockRegionBehaviorCollection(); } + + public IRegionManager Add(string viewName) => throw new NotImplementedException(); + public IRegionManager Add(object view) { MockViews.Items.Add(view); diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs index 63a58cd768..c6aac83c1a 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs @@ -36,6 +36,8 @@ public INavigationParameters NavigationParameters public string Name { get; set; } + public IRegionManager Add(string viewName) => throw new NotImplementedException(); + public IRegionManager Add(object view) { this.views.Add(view); From 5a7940632d9e488a23716d332bd1c5ca6ba2b8e0 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 2 Sep 2023 17:41:37 -0600 Subject: [PATCH 11/19] chore: fix incompatible setter for netstandard --- .../Behaviors/RegionCleanupBehavior.cs | 1 - .../Navigation/PageNavigationService.cs | 21 ++++++------------- .../INavigationServiceExtensions.cs | 2 +- .../Navigation/PageNavigationService.cs | 10 ++------- src/Prism.Core/Navigation/NavigationResult.cs | 15 ++++++++++--- .../Navigation/Xaml/GoBackExtensionFixture.cs | 8 +++---- .../Xaml/NavigateToExtensionFixture.cs | 2 +- 7 files changed, 26 insertions(+), 33 deletions(-) diff --git a/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs b/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs index 611901c603..4b66c04a5b 100644 --- a/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs @@ -1,7 +1,6 @@ using System; using Prism.Ioc; using Prism.Regions; -using Prism.Regions.Xaml; using Xamarin.Forms; namespace Prism.Behaviors diff --git a/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs b/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs index dd387c818a..382090704d 100644 --- a/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs +++ b/src/Forms/Prism.Forms/Navigation/PageNavigationService.cs @@ -101,10 +101,7 @@ protected async virtual Task GoBackInternal(INavigationParame var canNavigate = await PageUtilities.CanNavigateAsync(page, segmentParameters); if (!canNavigate) { - return new NavigationResult - { - Exception = new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page) - }; + return new NavigationResult(new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page)); } bool useModalForDoPop = UseModalGoBack(page, useModalNavigation); @@ -122,17 +119,14 @@ protected async virtual Task GoBackInternal(INavigationParame } catch (Exception ex) { - return new NavigationResult { Exception = ex }; + return new NavigationResult(ex); } finally { NavigationSource = PageNavigationSource.Device; } - return new NavigationResult - { - Exception = GetGoBackException(page, _applicationProvider.MainPage) - }; + return new NavigationResult(GetGoBackException(page, _applicationProvider.MainPage)); } private static Exception GetGoBackException(Page currentPage, Page mainPage) @@ -209,10 +203,7 @@ protected async virtual Task GoBackToRootInternal(INavigation var canNavigate = await PageUtilities.CanNavigateAsync(page, parameters); if (!canNavigate) { - return new NavigationResult - { - Exception = new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page) - }; + return new NavigationResult(new NavigationException(NavigationException.IConfirmNavigationReturnedFalse, page)); } List pagesToDestroy = page.Navigation.NavigationStack.ToList(); // get all pages to destroy @@ -234,7 +225,7 @@ protected async virtual Task GoBackToRootInternal(INavigation } catch (Exception ex) { - return new NavigationResult { Exception = ex }; + return new NavigationResult(ex); } } @@ -361,7 +352,7 @@ protected async virtual Task NavigateInternal(Uri uri, INavig } catch (Exception ex) { - return new NavigationResult { Exception = ex }; + return new NavigationResult(ex); } finally { diff --git a/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs b/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs index 69a8d6de10..120350bd59 100644 --- a/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs +++ b/src/Forms/Prism.Forms/Navigation/TabbedPages/INavigationServiceExtensions.cs @@ -77,7 +77,7 @@ public static async Task SelectTabAsync(this INavigationServi } catch (Exception ex) { - return new NavigationResult { Exception = ex }; + return new NavigationResult(ex); } return new NavigationResult(); diff --git a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs index 30133bf93a..87c0f29f03 100644 --- a/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs +++ b/src/Maui/Prism.Maui/Navigation/PageNavigationService.cs @@ -1142,10 +1142,7 @@ internal static bool UseReverseNavigation(Page currentPage, Type nextPageType) private INavigationResult Notify(NavigationRequestType type, INavigationParameters parameters, Exception exception = null) { - var result = new NavigationResult - { - Exception = exception - }; + var result = new NavigationResult(exception); _eventAggregator.GetEvent().Publish(new NavigationRequestContext { Parameters = parameters, @@ -1158,10 +1155,7 @@ private INavigationResult Notify(NavigationRequestType type, INavigationParamete private INavigationResult Notify(Uri uri, INavigationParameters parameters, Exception exception = null) { - var result = new NavigationResult - { - Exception = exception - }; + var result = new NavigationResult(exception); var temp = Regex.Replace(uri.ToString(), RemovePageInstruction, RemovePageRelativePath); diff --git a/src/Prism.Core/Navigation/NavigationResult.cs b/src/Prism.Core/Navigation/NavigationResult.cs index 69198f3504..ea0d3280c2 100644 --- a/src/Prism.Core/Navigation/NavigationResult.cs +++ b/src/Prism.Core/Navigation/NavigationResult.cs @@ -7,7 +7,7 @@ namespace Prism.Navigation; /// /// Default implementation for the /// -public record NavigationResult : INavigationResult +public class NavigationResult : INavigationResult { private readonly bool? _success; @@ -27,6 +27,15 @@ public NavigationResult(bool success) _success = success; } + /// + /// Initializes a new NavigationResult with an + /// + /// The encountered as part of the navigation. + public NavigationResult(Exception ex) + { + Exception = ex; + } + /// /// Initializes a new NavigationResult /// @@ -58,8 +67,8 @@ Exception is NavigationException navigationException && navigationException.Message == NavigationException.IConfirmNavigationReturnedFalse; /// - public Exception? Exception { get; init; } + public Exception? Exception { get; } /// - public NavigationContext? Context { get; init; } + public NavigationContext? Context { get; } } diff --git a/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/GoBackExtensionFixture.cs b/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/GoBackExtensionFixture.cs index b18176f82f..35768ce53c 100644 --- a/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/GoBackExtensionFixture.cs +++ b/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/GoBackExtensionFixture.cs @@ -62,7 +62,7 @@ public void Execute_GoBackTypeDefault_NavigationParameters_HasKnownNavigationPar { parameters = navParameters; }) - .ReturnsAsync(new NavigationResult { Exception = new Exception() }); + .ReturnsAsync(new NavigationResult(new Exception())); var registry = container.Resolve(); var page = registry.CreateView(container, "PageMock") as Page; @@ -125,7 +125,7 @@ public void Execute_GoBackTypeToRoot_NavigationParameters_DoNotHaveKnownNavigati { parameters = navParameters; }) - .ReturnsAsync(new NavigationResult { Exception = new Exception() }); + .ReturnsAsync(new NavigationResult(new Exception())); var registry = container.Resolve(); var page = registry.CreateView(container, "PageMock") as Page; @@ -159,7 +159,7 @@ public void Execute_GoBackTypeDefault_CommandParameter_IncludedInNavigationParam { parameters = navParameters; }) - .ReturnsAsync(new NavigationResult { Exception = new Exception() }); + .ReturnsAsync(new NavigationResult(new Exception())); var registry = container.Resolve(); var page = registry.CreateView(container, "PageMock") as Page; @@ -192,7 +192,7 @@ public void Execute_GoBackTypeToRoot_CommandParameter_IncludedInNavigationParame { parameters = navParameters; }) - .ReturnsAsync(new NavigationResult { Exception = new Exception() }); + .ReturnsAsync(new NavigationResult(new Exception())); var registry = container.Resolve(); var page = registry.CreateView(container, "PageMock") as Page; diff --git a/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs b/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs index 270a89c1fd..aa270792fa 100644 --- a/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs +++ b/tests/Maui/Prism.Maui.Tests/Fixtures/Navigation/Xaml/NavigateToExtensionFixture.cs @@ -78,7 +78,7 @@ public void Execute_NavigationParameters_HasKnownNavigationParameters(bool anima { parameters = navParameters; }) - .ReturnsAsync(new NavigationResult { Exception = new Exception() }); + .ReturnsAsync(new NavigationResult(new Exception())); var registry = container.Resolve(); var page = registry.CreateView(container, "PageMock") as Page; From 7398d7cc660b884c2ef22c01be20585601e201f7 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 2 Sep 2023 18:01:26 -0600 Subject: [PATCH 12/19] chore: fixing tests --- src/Forms/Prism.Forms.Regions/Regions/Region.cs | 10 +++------- .../Tests/NavigationAsyncExtensionsFixture.cs | 9 ++++++--- .../Tests/RegionManagerRequestNavigateFixture.cs | 8 ++++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/Forms/Prism.Forms.Regions/Regions/Region.cs b/src/Forms/Prism.Forms.Regions/Regions/Region.cs index 9884703466..ccf7cdeb81 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Region.cs +++ b/src/Forms/Prism.Forms.Regions/Regions/Region.cs @@ -311,7 +311,7 @@ private void InnerAdd(object view, string viewName, IRegionManager scopedRegionM /// /// The name used when adding the view to the region. /// Returns the named view or if the view with does not exist in the current region. - public virtual VisualElement GetView(string viewName) + public virtual object GetView(string viewName) { if (string.IsNullOrEmpty(viewName)) { @@ -431,14 +431,10 @@ private static int ViewSortHintAttributeComparison(ViewSortHintAttribute x, View } } - object IRegion.GetView(string viewName) - { - throw new NotImplementedException(); - } - + /// public void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters) { - throw new NotImplementedException(); + _regionNavigationService.RequestNavigate(target, navigationCallback, navigationParameters); } } } diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs index dfadb836bb..ef24662954 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs @@ -44,7 +44,8 @@ public void WhenNavigatingWithARelativeStringTarget_ThenNavigatesToRelativeUri() .Setup(nv => nv.RequestNavigate( It.Is(u => !u.IsAbsoluteUri && u.OriginalString == "relative"), - It.Is>(c => c != null))) + It.Is>(c => c != null), + It.Is(p => p != null))) .Verifiable(); string target = "relative"; @@ -62,7 +63,8 @@ public void WhenNavigatingWithAnAbsoluteStringTarget_ThenNavigatesToAbsoluteUri( .Setup(nv => nv.RequestNavigate( It.Is(u => u.IsAbsoluteUri && u.Host == "test" && u.AbsolutePath == "/path"), - It.Is>(c => c != null))) + It.Is>(c => c != null), + It.Is(p => p != null))) .Verifiable(); string target = "http://test/path"; @@ -95,7 +97,8 @@ public void WhenNavigatingWithAUri_ThenNavigatesToUriWithCallback() .Setup(nv => nv.RequestNavigate( target, - It.Is>(c => c != null))) + It.Is>(c => c != null), + It.Is(p => p != null))) .Verifiable(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs index 925519d853..60560df004 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs @@ -76,14 +76,14 @@ public void WhenNonExistentRegion_ReturnNavigationResultFalse() public void DelegatesCallToRegion_RegionSource() { regionManager.RequestNavigate(region, source); - mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), null)); + mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), It.IsAny())); } [Fact] public void DelegatesCallToRegion_RegionTarget() { regionManager.RequestNavigate(region, sourceUri); - mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), null)); + mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, It.IsAny>(), It.IsAny())); } [Fact] @@ -104,14 +104,14 @@ public void DelegatesCallToRegion_RegionSourceUriParameters() public void DelegatesCallToRegion_RegionSourceCallback() { regionManager.RequestNavigate(region, source, callback); - mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, null)); + mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, It.IsAny())); } [Fact] public void DelegatesCallToRegion_RegionTargetCallback() { regionManager.RequestNavigate(region, sourceUri, callback); - mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, null)); + mockNavigation.Verify((r) => r.RequestNavigate(sourceUri, callback, It.IsAny())); } [Fact] From 87af17bd6b514e02d09d028458cad5731c9792e3 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Mon, 4 Sep 2023 05:52:26 -0600 Subject: [PATCH 13/19] chore: migrate namespace to Prism.Navigation.Regions --- .../ViewModels/CarouselDemoRegionViewModel.cs | 2 +- .../CollectionViewDemoRegionViewModel.cs | 2 +- .../ContentViewDemoRegionViewModel.cs | 2 +- .../FlexLayoutDemoRegionViewModel.cs | 2 +- .../ViewModels/FrameDemoRegionViewModel.cs | 2 +- .../ViewModels/RegionAViewModel.cs | 2 +- .../ViewModels/RegionBViewModel.cs | 2 +- .../ViewModels/RegionCViewModel.cs | 2 +- .../HelloRegions/ViewModels/RegionDemoBase.cs | 4 +-- .../ScrollViewDemoRegionViewModel.cs | 2 +- .../StackLayoutDemoRegionViewModel.cs | 2 +- .../HelloRegions/ViewModels/ViewModelBase.cs | 2 +- .../ViewModels/MainWindowViewModel.cs | 4 +-- .../Behaviors/RegionCleanupBehavior.cs | 2 +- .../Prism.Forms.Regions/Common/MvvmHelpers.cs | 2 +- .../Ioc/RegionRegistrationExtensions.cs | 9 ++--- .../Ioc/RegionResolverOverrides.cs | 3 +- .../Adapters/CarouselViewRegionAdapter.cs | 7 +--- .../Adapters/CollectionViewRegionAdapter.cs | 3 +- .../Adapters/ContentViewRegionAdapter.cs | 3 +- .../Adapters/LayoutViewRegionAdapter.cs | 3 +- .../Regions/Adapters/RegionAdapterBase.cs | 4 +-- .../Regions/Adapters/RegionAdapterMappings.cs | 2 +- .../Adapters/RegionItemsSourceTemplate.cs | 2 +- .../Adapters/ScrollViewRegionAdapter.cs | 3 +- .../Regions/AllActiveRegion.cs | 2 +- .../Behaviors/AutoPopulateRegionBehavior.cs | 2 +- ...indRegionContextToVisualElementBehavior.cs | 4 +-- .../ClearChildViewsRegionBehavior.cs | 12 +++---- .../DelayedRegionCreationBehavior.cs | 8 ++--- .../Behaviors/DestructibleRegionBehavior.cs | 3 +- .../Behaviors/IHostAwareRegionBehavior.cs | 2 +- .../Behaviors/RegionActiveAwareBehavior.cs | 18 +++++----- .../RegionManagerRegistrationBehavior.cs | 2 +- .../Behaviors/RegionMemberLifetimeBehavior.cs | 6 ++-- .../SyncRegionContextWithHostBehavior.cs | 14 ++++---- .../Regions/DefaultRegionManagerAccessor.cs | 2 +- .../Regions/IActiveRegionHelper.cs | 2 +- .../Regions/INavigationServiceAware.cs | 4 +-- .../Regions/IRegionManagerAccessor.cs | 4 +-- .../{ => Navigation}/Regions/ItemMetadata.cs | 2 +- .../RegionNavigationContentLoader.cs | 2 +- .../Navigation/RegionNavigationService.cs | 4 +-- .../{ => Navigation}/Regions/Region.cs | 3 +- .../Regions/RegionCollection.cs | 4 +-- .../{ => Navigation}/Regions/RegionContext.cs | 4 +-- .../{ => Navigation}/Regions/RegionManager.cs | 3 +- .../Regions/SingleActiveRegion.cs | 2 +- .../Regions/ViewsCollection.cs | 36 +++++++++---------- .../Regions/Xaml/RegionManager.cs | 6 ++-- .../Prism.Forms.Regions.csproj | 14 ++++---- .../Properties/AssemblyInfo.cs | 2 +- src/Maui/Prism.Maui/Common/MvvmHelpers.cs | 3 +- .../RegionNavigationRegistrationExtensions.cs | 15 ++++---- .../Internals/ChildRegionCollection.cs | 2 +- .../Adapters/CarouselViewRegionAdapter.cs | 6 ++-- .../Adapters/CollectionViewRegionAdapter.cs | 3 +- .../Adapters/ContentViewRegionAdapter.cs | 5 +-- .../ContentViewRegionAdapter{TContentView}.cs | 3 +- .../Regions/Adapters/IRegionAdapter.cs | 2 +- .../Adapters/LayoutViewRegionAdapter.cs | 3 +- .../Regions/Adapters/RegionAdapterBase.cs | 5 ++- .../Regions/Adapters/RegionAdapterMappings.cs | 2 +- .../Adapters/RegionItemsSourceTemplate.cs | 2 +- .../Adapters/ScrollViewRegionAdapter.cs | 5 ++- .../Regions/AllActiveRegion.cs | 4 +-- .../Behaviors/AutoPopulateRegionBehavior.cs | 6 ++-- ...indRegionContextToVisualElementBehavior.cs | 4 +-- .../ClearChildViewsRegionBehavior.cs | 12 +++---- .../DelayedRegionCreationBehavior.cs | 8 ++--- .../Behaviors/DestructibleRegionBehavior.cs | 3 +- .../Behaviors/IHostAwareRegionBehavior.cs | 2 +- .../Behaviors/RegionActiveAwareBehavior.cs | 18 +++++----- .../Behaviors/RegionCreationException.cs | 6 ++-- .../RegionManagerRegistrationBehavior.cs | 10 +++--- .../Behaviors/RegionMemberLifetimeBehavior.cs | 6 ++-- .../SyncRegionContextWithHostBehavior.cs | 14 ++++---- .../Regions/DefaultRegionManagerAccessor.cs | 2 +- .../Regions/IRegionManagerAccessor.cs | 4 +-- .../Regions/IRegionMemberLifetime.cs | 4 +-- .../Regions/ITargetAwareRegion.cs | 3 +- .../{ => Navigation}/Regions/ItemMetadata.cs | 2 +- .../RegionNavigationContentLoader.cs | 4 +-- .../Navigation/RegionNavigationService.cs | 3 +- .../{ => Navigation}/Regions/Region.cs | 3 +- .../Regions/RegionCollection.cs | 4 +-- .../{ => Navigation}/Regions/RegionContext.cs | 4 +-- .../Regions/RegionExtensions.cs | 2 +- .../{ => Navigation}/Regions/RegionManager.cs | 3 +- .../Regions/RegionNavigationRegistry.cs | 2 +- .../Regions/RegionViewRegistry.cs | 8 ++--- .../Regions/SingleActiveRegion.cs | 4 +-- .../Regions/ViewsCollection.cs | 36 +++++++++---------- .../Regions/Xaml/RegionManager.cs | 12 +++---- src/Maui/Prism.Maui/PrismAppBuilder.cs | 4 +-- .../Prism.Maui/Properties/AssemblyInfo.cs | 2 +- .../Navigation/INavigationResult.cs | 2 +- src/Prism.Core/Navigation/NavigationResult.cs | 2 +- .../Regions/IConfirmNavigationRequest.cs | 2 +- .../{ => Navigation}/Regions/IJournalAware.cs | 2 +- .../Regions/INavigateAsync.cs | 6 ++-- .../{ => Navigation}/Regions/IRegion.cs | 2 +- .../Regions/IRegionAdapter.cs | 2 +- .../{ => Navigation}/Regions/IRegionAware.cs | 2 +- .../Regions/IRegionBehavior.cs | 2 +- .../Regions/IRegionBehaviorCollection.cs | 8 ++--- .../Regions/IRegionBehaviorFactory.cs | 2 +- .../IRegionBehaviorFactoryExtensions.cs | 2 +- .../Regions/IRegionCollection.cs | 4 +-- .../Regions/IRegionManager.cs | 2 +- .../Regions/IRegionManagerExtensions.cs | 2 +- .../Regions/IRegionMemberLifetime.cs | 2 +- .../Regions/IRegionNavigationContentLoader.cs | 2 +- .../Regions/IRegionNavigationJournal.cs | 2 +- .../Regions/IRegionNavigationJournalEntry.cs | 2 +- .../Regions/IRegionNavigationRegistry.cs | 2 +- .../Regions/IRegionNavigationService.cs | 2 +- .../Regions/IRegionViewRegistry.cs | 4 +-- .../Regions/IViewsCollection.cs | 2 +- .../Regions/NavigationAsyncExtensions.cs | 4 +-- .../Regions/NavigationContext.cs | 6 ++-- .../Regions/NavigationContextExtensions.cs | 2 +- .../Regions/RegionBehavior.cs | 2 +- .../Regions/RegionBehaviorCollection.cs | 2 +- .../Regions/RegionBehaviorFactory.cs | 2 +- .../Regions/RegionCreationException.cs | 2 +- .../Regions/RegionException.cs | 2 +- .../Regions/RegionMemberLifetimeAttribute.cs | 2 +- .../Regions/RegionNavigationEventArgs.cs | 2 +- .../RegionNavigationFailedEventArgs.cs | 2 +- .../Regions/RegionNavigationJournal.cs | 4 +-- .../Regions/RegionNavigationJournalEntry.cs | 2 +- .../Regions/RegionViewRegistryExtensions.cs | 4 +-- .../Regions/SyncActiveStateAttribute.cs | 2 +- .../Regions/UpdateRegionsException.cs | 8 ++--- .../Regions/ViewRegisteredEventArgs.cs | 2 +- .../Regions/ViewRegistrationException.cs | 6 ++-- .../Regions/ViewSortHintAttribute.cs | 2 +- src/Prism.Core/build/Package.targets | 2 +- src/Uno/Prism.Uno/PrismApplicationBase.cs | 7 ++-- src/Wpf/Prism.DryIoc.Wpf/PrismApplication.cs | 4 +-- .../Regions/AllActiveRegion.cs | 2 +- .../Behaviors/AutoPopulateRegionBehavior.cs | 2 +- ...RegionContextToDependencyObjectBehavior.cs | 4 +-- .../ClearChildViewsRegionBehavior.cs | 4 +-- .../DelayedRegionCreationBehavior.cs | 2 +- .../Behaviors/DestructibleRegionBehavior.cs | 3 +- .../Behaviors/IHostAwareRegionBehavior.cs | 4 +-- .../Behaviors/RegionActiveAwareBehavior.cs | 7 ++-- .../RegionManagerRegistrationBehavior.cs | 5 +-- .../Behaviors/RegionMemberLifetimeBehavior.cs | 4 +-- .../SelectorItemsSourceSyncBehavior.cs | 4 +-- .../SyncRegionContextWithHostBehavior.cs | 4 +-- .../Regions/ContentControlRegionAdapter.cs | 4 +-- .../Regions/DefaultRegionManagerAccessor.cs | 2 +- .../Regions/INavigationAware.cs | 2 +- .../Regions/IRegionManagerAccessor.cs | 2 +- .../{ => Navigation}/Regions/ItemMetadata.cs | 2 +- .../Regions/ItemsControlRegionAdapter.cs | 4 +-- .../{ => Navigation}/Regions/Region.cs | 4 +-- .../Regions/RegionAdapterBase.cs | 6 ++-- .../Regions/RegionAdapterMappings.cs | 2 +- .../{ => Navigation}/Regions/RegionContext.cs | 4 +-- .../{ => Navigation}/Regions/RegionManager.cs | 5 ++- .../Regions/RegionNavigationContentLoader.cs | 2 +- .../Regions/RegionNavigationService.cs | 3 +- .../Regions/RegionViewRegistry.cs | 6 ++-- .../Regions/SelectorRegionAdapter.cs | 4 +-- .../Regions/SingleActiveRegion.cs | 2 +- .../Regions/ViewsCollection.cs | 4 +-- src/Wpf/Prism.Wpf/PrismApplicationBase.cs | 8 ++--- src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs | 8 ++--- .../PrismInitializationExtensions.cs | 4 +-- src/Wpf/Prism.Wpf/Properties/AssemblyInfo.cs | 12 +++---- .../ViewModels/Issue2415PageViewModel.cs | 4 +-- .../Mocks/MockPresentationRegion.cs | 6 ++-- .../Mocks/MockRegion.cs | 6 ++-- .../Mocks/MockRegionAdapter.cs | 6 ++-- .../Mocks/MockRegionBehavior.cs | 4 +-- .../Mocks/MockRegionBehaviorCollection.cs | 2 +- .../Mocks/MockRegionManagerAccessor.cs | 3 +- .../Mocks/MockSortableView1.cs | 2 +- .../Mocks/MockSortableView2.cs | 2 +- .../Mocks/MockSortableView3.cs | 2 +- .../Mocks/MockViewsCollection.cs | 2 +- .../Tests/AllActiveRegionFixture.cs | 2 +- .../Tests/ContentViewRegionAdapterFixture.cs | 4 +-- .../LocatorNavigationTargetHandlerFixture.cs | 7 ++-- .../Tests/NavigationAsyncExtensionsFixture.cs | 2 +- .../Tests/NavigationContextFixture.cs | 4 +-- .../Tests/RegionAdapterBaseFixture.cs | 4 +-- .../Tests/RegionAdapterMappingFixture.cs | 2 +- .../Tests/RegionBehaviorCollectionFixture.cs | 2 +- .../Tests/RegionBehaviorFactoryFixture.cs | 2 +- .../Tests/RegionBehaviorFixture.cs | 4 +-- .../Tests/RegionFixture.cs | 18 +++++----- .../Tests/RegionManagerFixture.cs | 21 ++++++----- .../RegionManagerRequestNavigateFixture.cs | 5 +-- .../Tests/RegionNavigationJournalFixture.cs | 4 +-- .../Tests/RegionNavigationServiceFixture.cs | 9 ++--- .../Tests/RegionViewRegistryFixture.cs | 2 +- .../Tests/SingleActiveRegionFixture.cs | 2 +- .../Tests/ViewsCollectionFixture.cs | 5 +-- .../Mocks/Views/MockContentRegionPage.cs | 4 +-- .../Views/MockPageWithRegionAndDefaultView.cs | 4 +-- .../Bootstrapper/BootstrapperFixture.cs | 2 +- .../BootstrapperRunMethodFixture.cs | 2 +- .../RegionNavigationContentLoaderFixture.cs | 2 +- .../Fixtures/BootstrapperRunMethodFixture.cs | 2 +- .../Mocks/MockBootstrapper.cs | 2 +- .../Mocks/MockRegionManager.cs | 2 +- .../Fixtures/BootstrapperRunMethodFixture.cs | 2 +- .../Mocks/MockBootstrapper.cs | 2 +- .../Mocks/MockHostAwareRegionBehavior.cs | 4 +-- .../Mocks/MockPresentationRegion.cs | 2 +- tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs | 2 +- .../Mocks/MockRegionAdapter.cs | 2 +- .../Mocks/MockRegionBehavior.cs | 2 +- .../Mocks/MockRegionBehaviorCollection.cs | 2 +- .../Mocks/MockRegionManager.cs | 2 +- .../Mocks/MockRegionManagerAccessor.cs | 2 +- .../Mocks/MockSortableViews.cs | 2 +- .../Mocks/MockViewsCollection.cs | 2 +- .../PrismApplicationBaseFixture.cs | 6 ++-- .../PrismBootstapperBaseFixture.cs | 6 ++-- .../Regions/AllActiveRegionFixture.cs | 2 +- .../AutoPopulateRegionBehaviorFixture.cs | 4 +-- ...ontextToDependencyObjectBehaviorFixture.cs | 4 +-- .../ClearChildViewsRegionBehaviorFixture.cs | 4 +-- .../DelayedRegionCreationBehaviorFixture.cs | 4 +-- .../RegionActiveAwareBehaviorFixture.cs | 4 +-- ...egionManagerRegistrationBehaviorFixture.cs | 4 +-- .../RegionMemberLifetimeBehaviorFixture.cs | 4 +-- ...torItemsSourceSyncRegionBehaviorFixture.cs | 4 +-- ...yncRegionContextWithHostBehaviorFixture.cs | 4 +-- .../ContentControlRegionAdapterFixture.cs | 2 +- .../ItemsControlRegionAdapterFixture.cs | 2 +- .../LocatorNavigationTargetHandlerFixture.cs | 2 +- .../NavigationAsyncExtensionsFixture.cs | 2 +- .../Regions/NavigationContextFixture.cs | 2 +- .../Regions/RegionAdapterBaseFixture.cs | 2 +- .../Regions/RegionAdapterMappingsFixture.cs | 2 +- .../RegionBehaviorCollectionFixture.cs | 2 +- .../Regions/RegionBehaviorFactoryFixture.cs | 2 +- .../Regions/RegionBehaviorFixture.cs | 2 +- .../Prism.Wpf.Tests/Regions/RegionFixture.cs | 2 +- .../Regions/RegionManagerFixture.cs | 2 +- .../RegionManagerRequestNavigateFixture.cs | 2 +- .../Regions/RegionNavigationJournalFixture.cs | 2 +- .../RegionNavigationServiceFixture.new.cs | 2 +- .../Regions/RegionViewRegistryFixture.cs | 2 +- .../Regions/SelectorRegionAdapterFixture.cs | 4 +-- .../Regions/SingleActiveRegionFixture.cs | 2 +- .../Regions/ViewsCollectionFixture.cs | 2 +- 254 files changed, 484 insertions(+), 551 deletions(-) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/CarouselViewRegionAdapter.cs (96%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/CollectionViewRegionAdapter.cs (97%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/ContentViewRegionAdapter.cs (98%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/LayoutViewRegionAdapter.cs (97%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/RegionAdapterBase.cs (98%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/RegionAdapterMappings.cs (99%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/RegionItemsSourceTemplate.cs (94%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Adapters/ScrollViewRegionAdapter.cs (97%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/AllActiveRegion.cs (96%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/AutoPopulateRegionBehavior.cs (98%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs (97%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/ClearChildViewsRegionBehavior.cs (88%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/DelayedRegionCreationBehavior.cs (96%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/DestructibleRegionBehavior.cs (94%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/IHostAwareRegionBehavior.cs (94%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/RegionActiveAwareBehavior.cs (88%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/RegionManagerRegistrationBehavior.cs (99%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/RegionMemberLifetimeBehavior.cs (97%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs (92%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/DefaultRegionManagerAccessor.cs (98%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/IActiveRegionHelper.cs (72%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/INavigationServiceAware.cs (70%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/IRegionManagerAccessor.cs (96%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/ItemMetadata.cs (98%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Navigation/RegionNavigationContentLoader.cs (99%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Navigation/RegionNavigationService.cs (99%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Region.cs (99%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/RegionCollection.cs (98%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/RegionContext.cs (96%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/RegionManager.cs (99%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/SingleActiveRegion.cs (96%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/ViewsCollection.cs (92%) rename src/Forms/Prism.Forms.Regions/{ => Navigation}/Regions/Xaml/RegionManager.cs (98%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/CarouselViewRegionAdapter.cs (97%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/CollectionViewRegionAdapter.cs (96%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/ContentViewRegionAdapter.cs (88%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs (97%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/IRegionAdapter.cs (92%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/LayoutViewRegionAdapter.cs (96%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/RegionAdapterBase.cs (98%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/RegionAdapterMappings.cs (99%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/RegionItemsSourceTemplate.cs (92%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Adapters/ScrollViewRegionAdapter.cs (96%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/AllActiveRegion.cs (96%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/AutoPopulateRegionBehavior.cs (96%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs (97%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/ClearChildViewsRegionBehavior.cs (88%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/DelayedRegionCreationBehavior.cs (96%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/DestructibleRegionBehavior.cs (94%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/IHostAwareRegionBehavior.cs (92%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/RegionActiveAwareBehavior.cs (86%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/RegionCreationException.cs (94%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/RegionManagerRegistrationBehavior.cs (95%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/RegionMemberLifetimeBehavior.cs (97%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs (92%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/DefaultRegionManagerAccessor.cs (98%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/IRegionManagerAccessor.cs (96%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/IRegionMemberLifetime.cs (85%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/ITargetAwareRegion.cs (88%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/ItemMetadata.cs (98%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Navigation/RegionNavigationContentLoader.cs (98%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Navigation/RegionNavigationService.cs (99%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Region.cs (99%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/RegionCollection.cs (97%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/RegionContext.cs (95%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/RegionExtensions.cs (90%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/RegionManager.cs (99%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/RegionNavigationRegistry.cs (91%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/RegionViewRegistry.cs (97%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/SingleActiveRegion.cs (94%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/ViewsCollection.cs (91%) rename src/Maui/Prism.Maui/{ => Navigation}/Regions/Xaml/RegionManager.cs (97%) rename src/Prism.Core/{ => Navigation}/Regions/IConfirmNavigationRequest.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/IJournalAware.cs (92%) rename src/Prism.Core/{ => Navigation}/Regions/INavigateAsync.cs (91%) rename src/Prism.Core/{ => Navigation}/Regions/IRegion.cs (99%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionAdapter.cs (94%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionAware.cs (97%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionBehavior.cs (92%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionBehaviorCollection.cs (89%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionBehaviorFactory.cs (97%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionBehaviorFactoryExtensions.cs (97%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionCollection.cs (97%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionManager.cs (99%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionManagerExtensions.cs (99%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionMemberLifetime.cs (93%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionNavigationContentLoader.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionNavigationJournal.cs (98%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionNavigationJournalEntry.cs (93%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionNavigationRegistry.cs (70%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionNavigationService.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/IRegionViewRegistry.cs (97%) rename src/Prism.Core/{ => Navigation}/Regions/IViewsCollection.cs (94%) rename src/Prism.Core/{ => Navigation}/Regions/NavigationAsyncExtensions.cs (98%) rename src/Prism.Core/{ => Navigation}/Regions/NavigationContext.cs (95%) rename src/Prism.Core/{ => Navigation}/Regions/NavigationContextExtensions.cs (95%) rename src/Prism.Core/{ => Navigation}/Regions/RegionBehavior.cs (97%) rename src/Prism.Core/{ => Navigation}/Regions/RegionBehaviorCollection.cs (99%) rename src/Prism.Core/{ => Navigation}/Regions/RegionBehaviorFactory.cs (99%) rename src/Prism.Core/{ => Navigation}/Regions/RegionCreationException.cs (95%) rename src/Prism.Core/{ => Navigation}/Regions/RegionException.cs (94%) rename src/Prism.Core/{ => Navigation}/Regions/RegionMemberLifetimeAttribute.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/RegionNavigationEventArgs.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/RegionNavigationFailedEventArgs.cs (98%) rename src/Prism.Core/{ => Navigation}/Regions/RegionNavigationJournal.cs (98%) rename src/Prism.Core/{ => Navigation}/Regions/RegionNavigationJournalEntry.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/RegionViewRegistryExtensions.cs (95%) rename src/Prism.Core/{ => Navigation}/Regions/SyncActiveStateAttribute.cs (88%) rename src/Prism.Core/{ => Navigation}/Regions/UpdateRegionsException.cs (95%) rename src/Prism.Core/{ => Navigation}/Regions/ViewRegisteredEventArgs.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/ViewRegistrationException.cs (96%) rename src/Prism.Core/{ => Navigation}/Regions/ViewSortHintAttribute.cs (95%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/AllActiveRegion.cs (96%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/AutoPopulateRegionBehavior.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/BindRegionContextToDependencyObjectBehavior.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/ClearChildViewsRegionBehavior.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/DelayedRegionCreationBehavior.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/DestructibleRegionBehavior.cs (95%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/IHostAwareRegionBehavior.cs (94%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/RegionActiveAwareBehavior.cs (95%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/RegionManagerRegistrationBehavior.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/RegionMemberLifetimeBehavior.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/SelectorItemsSourceSyncBehavior.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/ContentControlRegionAdapter.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/DefaultRegionManagerAccessor.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/INavigationAware.cs (90%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/IRegionManagerAccessor.cs (97%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/ItemMetadata.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/ItemsControlRegionAdapter.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/Region.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/RegionAdapterBase.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/RegionAdapterMappings.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/RegionContext.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/RegionManager.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/RegionNavigationContentLoader.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/RegionNavigationService.cs (99%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/RegionViewRegistry.cs (98%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/SelectorRegionAdapter.cs (97%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/SingleActiveRegion.cs (96%) rename src/Wpf/Prism.Wpf/{ => Navigation}/Regions/ViewsCollection.cs (99%) diff --git a/e2e/Forms/src/HelloRegions/ViewModels/CarouselDemoRegionViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/CarouselDemoRegionViewModel.cs index c81144a1ff..73286f9d2c 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/CarouselDemoRegionViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/CarouselDemoRegionViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/CollectionViewDemoRegionViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/CollectionViewDemoRegionViewModel.cs index 0418ed476e..16e23acee9 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/CollectionViewDemoRegionViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/CollectionViewDemoRegionViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/ContentViewDemoRegionViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/ContentViewDemoRegionViewModel.cs index 5b171ec8fc..ab4266b9aa 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/ContentViewDemoRegionViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/ContentViewDemoRegionViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/FlexLayoutDemoRegionViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/FlexLayoutDemoRegionViewModel.cs index 91c2c0e6f6..ff81107151 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/FlexLayoutDemoRegionViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/FlexLayoutDemoRegionViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/FrameDemoRegionViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/FrameDemoRegionViewModel.cs index 94bc895308..91a85f4e9a 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/FrameDemoRegionViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/FrameDemoRegionViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/RegionAViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/RegionAViewModel.cs index 75531b16a9..9b291c5a96 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/RegionAViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/RegionAViewModel.cs @@ -3,7 +3,7 @@ using System.Windows.Input; using Prism.Commands; using Prism.Navigation; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions.Navigation; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/RegionBViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/RegionBViewModel.cs index 6bd547395f..8f229dba0a 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/RegionBViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/RegionBViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions.Navigation; +using Prism.Navigation.Regions.Navigation; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/RegionCViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/RegionCViewModel.cs index 220bac4ed6..102c68e3d7 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/RegionCViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/RegionCViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions.Navigation; +using Prism.Navigation.Regions.Navigation; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs b/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs index 0d0bfd46b6..2cc51cf611 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs @@ -2,8 +2,8 @@ using Prism.Commands; using Prism.Mvvm; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Navigation; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/ScrollViewDemoRegionViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/ScrollViewDemoRegionViewModel.cs index d22bb75c63..92499b059f 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/ScrollViewDemoRegionViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/ScrollViewDemoRegionViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/StackLayoutDemoRegionViewModel.cs b/e2e/Forms/src/HelloRegions/ViewModels/StackLayoutDemoRegionViewModel.cs index 4faa8db136..76cf084384 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/StackLayoutDemoRegionViewModel.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/StackLayoutDemoRegionViewModel.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { diff --git a/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs b/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs index 442730a261..8e179a3b72 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs @@ -1,7 +1,7 @@ using System; using Prism.Commands; using Prism.Mvvm; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions.Navigation; namespace HelloRegions.ViewModels { diff --git a/e2e/Wpf/HelloWorld/ViewModels/MainWindowViewModel.cs b/e2e/Wpf/HelloWorld/ViewModels/MainWindowViewModel.cs index 7d2d649890..85dd65a26f 100644 --- a/e2e/Wpf/HelloWorld/ViewModels/MainWindowViewModel.cs +++ b/e2e/Wpf/HelloWorld/ViewModels/MainWindowViewModel.cs @@ -2,7 +2,7 @@ using HelloWorld.Core; using Prism.Commands; using Prism.Mvvm; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Dialogs; namespace HelloWorld.ViewModels @@ -35,7 +35,7 @@ public MainWindowViewModel(IDialogService dialogService, IRegionManager regionMa { _dialogService = dialogService; _regionManager = regionManager; - ShowDialogCommand = new DelegateCommand(ShowDialog); + ShowDialogCommand = new DelegateCommand(ShowDialog); } private void ShowDialog() diff --git a/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs b/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs index 4b66c04a5b..7243c0ca66 100644 --- a/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Behaviors/RegionCleanupBehavior.cs @@ -1,6 +1,6 @@ using System; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Behaviors diff --git a/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs b/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs index b944a86280..048ab9aba1 100644 --- a/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs +++ b/src/Forms/Prism.Forms.Regions/Common/MvvmHelpers.cs @@ -1,5 +1,5 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Common diff --git a/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs b/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs index eb64c8b4b6..0d47e34c5e 100644 --- a/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs +++ b/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs @@ -1,8 +1,9 @@ using System; -using Prism.Regions; -using Prism.Regions.Adapters; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Adapters; +using Prism.Navigation.Regions.Behaviors; +using Prism.Navigation.Regions.Navigation; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Ioc diff --git a/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs b/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs index a4d3577988..a019f619bc 100644 --- a/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs +++ b/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs @@ -1,7 +1,8 @@ using System; using System.Collections.Generic; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions; namespace Prism.Ioc { diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/CarouselViewRegionAdapter.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/CarouselViewRegionAdapter.cs similarity index 96% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/CarouselViewRegionAdapter.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/CarouselViewRegionAdapter.cs index 4ec0367111..c992b4d2e4 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/CarouselViewRegionAdapter.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/CarouselViewRegionAdapter.cs @@ -1,18 +1,13 @@ using System; -using System.Collections.Generic; -using System.Collections.ObjectModel; using System.Collections.Specialized; using System.Linq; using Prism.Behaviors; using Prism.Common; using Prism.Ioc; -using Prism.Navigation; using Prism.Properties; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; using Xamarin.Forms; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { /// /// Adapter that creates a new and monitors its diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/CollectionViewRegionAdapter.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/CollectionViewRegionAdapter.cs similarity index 97% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/CollectionViewRegionAdapter.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/CollectionViewRegionAdapter.cs index a3a507879a..7c408181e7 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/CollectionViewRegionAdapter.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/CollectionViewRegionAdapter.cs @@ -1,10 +1,9 @@ using System; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; using Xamarin.Forms; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { /// /// Adapter that creates a new and monitors its diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/ContentViewRegionAdapter.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/ContentViewRegionAdapter.cs similarity index 98% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/ContentViewRegionAdapter.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/ContentViewRegionAdapter.cs index dfe0b539db..a47e7c062c 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/ContentViewRegionAdapter.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/ContentViewRegionAdapter.cs @@ -3,10 +3,9 @@ using System.Linq; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; using Xamarin.Forms; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { /// /// Adapter that creates a new and monitors its diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/LayoutViewRegionAdapter.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/LayoutViewRegionAdapter.cs similarity index 97% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/LayoutViewRegionAdapter.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/LayoutViewRegionAdapter.cs index a7fa31315d..c1bf7237ef 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/LayoutViewRegionAdapter.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/LayoutViewRegionAdapter.cs @@ -2,10 +2,9 @@ using System.Linq; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; using Xamarin.Forms; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { /// /// Adapter that creates a new and monitors its diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionAdapterBase.cs similarity index 98% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionAdapterBase.cs index 7ca851c3df..7f89095adc 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterBase.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionAdapterBase.cs @@ -1,10 +1,10 @@ using System; using System.Globalization; +using Prism.Navigation.Regions.Behaviors; using Prism.Properties; -using Prism.Regions.Behaviors; using Xamarin.Forms; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { /// /// Base class to facilitate the creation of implementations. diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterMappings.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionAdapterMappings.cs similarity index 99% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterMappings.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionAdapterMappings.cs index fcfb985418..4a4fedc19a 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionAdapterMappings.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionAdapterMappings.cs @@ -4,7 +4,7 @@ using Prism.Ioc; using Prism.Properties; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { /// /// This class maps with . diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionItemsSourceTemplate.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionItemsSourceTemplate.cs similarity index 94% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionItemsSourceTemplate.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionItemsSourceTemplate.cs index 1fdb366588..b765baf2c3 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/RegionItemsSourceTemplate.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/RegionItemsSourceTemplate.cs @@ -1,6 +1,6 @@ using Xamarin.Forms; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { // Implementation Note: // In discussing with PureWeen, it is best to provide a ContentView and provide a diff --git a/src/Forms/Prism.Forms.Regions/Regions/Adapters/ScrollViewRegionAdapter.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/ScrollViewRegionAdapter.cs similarity index 97% rename from src/Forms/Prism.Forms.Regions/Regions/Adapters/ScrollViewRegionAdapter.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/ScrollViewRegionAdapter.cs index 9ebf834297..8836c44f84 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Adapters/ScrollViewRegionAdapter.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Adapters/ScrollViewRegionAdapter.cs @@ -3,10 +3,9 @@ using System.Linq; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; using Xamarin.Forms; -namespace Prism.Regions.Adapters +namespace Prism.Navigation.Regions.Adapters { /// /// Adapter that creates a new and monitors its diff --git a/src/Forms/Prism.Forms.Regions/Regions/AllActiveRegion.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/AllActiveRegion.cs similarity index 96% rename from src/Forms/Prism.Forms.Regions/Regions/AllActiveRegion.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/AllActiveRegion.cs index eb56fc001f..4f43a6ade1 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/AllActiveRegion.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/AllActiveRegion.cs @@ -1,7 +1,7 @@ using System; using Prism.Properties; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Region that keeps all the views in it as active. Deactivation of views is not allowed. diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/AutoPopulateRegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs similarity index 98% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/AutoPopulateRegionBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs index 51c4496df3..fc7d507372 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/AutoPopulateRegionBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs @@ -4,7 +4,7 @@ using Prism.Ioc; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Populates the target region with the views registered to it in the . diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs similarity index 97% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs index e84320712d..a1137913a9 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs @@ -4,10 +4,10 @@ using Prism.Common; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// - /// Defines a behavior that forwards the + /// Defines a behavior that forwards the /// to the views in the region. /// public class BindRegionContextToVisualElementBehavior : IRegionBehavior diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/ClearChildViewsRegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs similarity index 88% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/ClearChildViewsRegionBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs index 66528d71ce..70b3a9448b 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/ClearChildViewsRegionBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs @@ -2,7 +2,7 @@ using System.Linq; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Behavior that removes the RegionManager attached property of all the views in a region once the RegionManager property of a region becomes null. @@ -35,7 +35,7 @@ public static bool GetClearChildViews(BindableObject target) if (target == null) throw new ArgumentNullException(nameof(target)); - return (bool)target.GetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty); + return (bool)target.GetValue(ClearChildViewsProperty); } /// @@ -48,7 +48,7 @@ public static void SetClearChildViews(BindableObject target, bool value) if (target == null) throw new ArgumentNullException(nameof(target)); - target.SetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty, value); + target.SetValue(ClearChildViewsProperty, value); } /// @@ -56,7 +56,7 @@ public static void SetClearChildViews(BindableObject target, bool value) /// protected override void OnAttach() { - this.Region.PropertyChanged += Region_PropertyChanged; + Region.PropertyChanged += Region_PropertyChanged; } private static void ClearChildViews(IRegion region) @@ -74,9 +74,9 @@ private void Region_PropertyChanged(object sender, System.ComponentModel.Propert { if (e.PropertyName == "RegionManager") { - if (this.Region.RegionManager == null) + if (Region.RegionManager == null) { - ClearChildViews(this.Region); + ClearChildViews(Region); } } } diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/DelayedRegionCreationBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs similarity index 96% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/DelayedRegionCreationBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs index 56d4080f5e..6104d86baa 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/DelayedRegionCreationBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs @@ -5,11 +5,11 @@ using System.Globalization; using Prism.Behaviors; using Prism.Extensions; +using Prism.Navigation.Regions.Adapters; using Prism.Properties; -using Prism.Regions.Adapters; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Behavior that creates a new , when the control that will host the (see ) @@ -99,7 +99,7 @@ public void Detach() /// Called when the is updating it's collection. /// /// The . - /// The instance containing the event data. + /// The instance containing the event data. public void OnUpdatingRegions(object sender, EventArgs e) { TryCreateRegion(); @@ -153,7 +153,7 @@ protected virtual IRegion CreateRegion(VisualElement targetElement, string regio page.Behaviors.Add(cleanupBehavior); if (region is INavigationServiceAware nsa) { - nsa.NavigationService = Prism.Navigation.Xaml.Navigation.GetNavigationService(page); + nsa.NavigationService = global::Prism.Navigation.Xaml.Navigation.GetNavigationService(page); } return region; diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/DestructibleRegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs similarity index 94% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/DestructibleRegionBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs index b6bb31de22..ed561d6b10 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/DestructibleRegionBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs @@ -1,8 +1,7 @@ using System.Collections.Specialized; using Prism.Common; -using Prism.Navigation; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Provides a Behavior to Destroy the View/ViewModel when the View is removed from the Region's Views diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IHostAwareRegionBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs similarity index 94% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/IHostAwareRegionBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs index 7f63dc7c77..dc983def10 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/IHostAwareRegionBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs @@ -1,6 +1,6 @@ using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Defines a that not allows extensible behaviors on regions which also interact diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionActiveAwareBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs similarity index 88% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionActiveAwareBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs index a1456d7014..795f1f747e 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionActiveAwareBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs @@ -4,17 +4,17 @@ using Prism.Common; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// - /// Behavior that monitors a object and + /// Behavior that monitors a object and /// changes the value for the property when - /// an object that implements gets added or removed + /// an object that implements gets added or removed /// from the collection. /// /// /// This class can also sync the active state for any scoped regions directly on the view based on the . - /// If you use the method with the createRegionManagerScope option, the scoped manager will be attached to the view. + /// If you use the method with the createRegionManagerScope option, the scoped manager will be attached to the view. /// public class RegionActiveAwareBehavior : IRegionBehavior { @@ -33,7 +33,7 @@ public class RegionActiveAwareBehavior : IRegionBehavior /// public void Attach() { - INotifyCollectionChanged collection = this.GetCollection(); + INotifyCollectionChanged collection = GetCollection(); if (collection != null) { collection.CollectionChanged += OnCollectionChanged; @@ -45,7 +45,7 @@ public void Attach() /// public void Detach() { - INotifyCollectionChanged collection = this.GetCollection(); + INotifyCollectionChanged collection = GetCollection(); if (collection != null) { collection.CollectionChanged -= OnCollectionChanged; @@ -82,13 +82,13 @@ private void InvokeOnSynchronizedActiveAwareChildren(object item, Action e.ActiveViews).OfType(); @@ -115,7 +115,7 @@ private bool ShouldSyncActiveState(VisualElement view) private INotifyCollectionChanged GetCollection() { - return this.Region.ActiveViews; + return Region.ActiveViews; } } } diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionManagerRegistrationBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs similarity index 99% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionManagerRegistrationBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs index 37bca6f28e..be794e2567 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionManagerRegistrationBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs @@ -3,7 +3,7 @@ using Prism.Properties; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Subscribes to a static event from the in order to register the target diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionMemberLifetimeBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs similarity index 97% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionMemberLifetimeBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs index 2bbab455e8..ea1eec209d 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/RegionMemberLifetimeBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs @@ -5,7 +5,7 @@ using Prism.Common; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// The RegionMemberLifetimeBehavior determines if items should be removed from the @@ -13,10 +13,10 @@ namespace Prism.Regions.Behaviors /// /// /// The monitors the - /// collection to discover items that transition into a deactivated state. + /// collection to discover items that transition into a deactivated state. ///

/// The behavior checks the removed items for either the - /// or the (in that order) to determine if it should be kept + /// or the (in that order) to determine if it should be kept /// alive on removal. ///

/// If the item in the collection is a , it will diff --git a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs similarity index 92% rename from src/Forms/Prism.Forms.Regions/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs index d8ad59fdee..80d7608024 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs @@ -3,14 +3,14 @@ using Prism.Properties; using Xamarin.Forms; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { ///

- /// Behavior that synchronizes the property of a with - /// the control that hosts the Region. It does this by setting the + /// Behavior that synchronizes the property of a with + /// the control that hosts the Region. It does this by setting the /// Dependency Property on the host control. - /// - /// This behavior allows the usage of two way databinding of the RegionContext from XAML. + /// + /// This behavior allows the usage of two way databinding of the RegionContext from XAML. /// public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegionBehavior { @@ -18,7 +18,7 @@ public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegio private VisualElement _hostControl; /// - /// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors. + /// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors. /// public static readonly string BehaviorKey = "SyncRegionContextWithHost"; @@ -54,7 +54,7 @@ protected override void OnAttach() { if (HostControl != null) { - // Sync values initially. + // Sync values initially. SynchronizeRegionContext(); // Now register for events to keep them in sync diff --git a/src/Forms/Prism.Forms.Regions/Regions/DefaultRegionManagerAccessor.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/DefaultRegionManagerAccessor.cs similarity index 98% rename from src/Forms/Prism.Forms.Regions/Regions/DefaultRegionManagerAccessor.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/DefaultRegionManagerAccessor.cs index 5402362485..11a45305a6 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/DefaultRegionManagerAccessor.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/DefaultRegionManagerAccessor.cs @@ -2,7 +2,7 @@ using Prism.Ioc; using Xamarin.Forms; -namespace Prism.Regions +namespace Prism.Navigation.Regions { internal class DefaultRegionManagerAccessor : IRegionManagerAccessor { diff --git a/src/Forms/Prism.Forms.Regions/Regions/IActiveRegionHelper.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/IActiveRegionHelper.cs similarity index 72% rename from src/Forms/Prism.Forms.Regions/Regions/IActiveRegionHelper.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/IActiveRegionHelper.cs index 6685df2ba0..eb194ca987 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/IActiveRegionHelper.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/IActiveRegionHelper.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { internal interface IActiveRegionHelper { diff --git a/src/Forms/Prism.Forms.Regions/Regions/INavigationServiceAware.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/INavigationServiceAware.cs similarity index 70% rename from src/Forms/Prism.Forms.Regions/Regions/INavigationServiceAware.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/INavigationServiceAware.cs index 9086796f6d..d080839b14 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/INavigationServiceAware.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/INavigationServiceAware.cs @@ -1,6 +1,4 @@ -using Prism.Navigation; - -namespace Prism.Regions +namespace Prism.Navigation.Regions { internal interface INavigationServiceAware { diff --git a/src/Forms/Prism.Forms.Regions/Regions/IRegionManagerAccessor.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/IRegionManagerAccessor.cs similarity index 96% rename from src/Forms/Prism.Forms.Regions/Regions/IRegionManagerAccessor.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/IRegionManagerAccessor.cs index 88a2bb394e..525a7ee20c 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/IRegionManagerAccessor.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/IRegionManagerAccessor.cs @@ -1,7 +1,7 @@ using System; using Xamarin.Forms; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides an abstraction on top of the RegionManager static members. @@ -19,7 +19,7 @@ public interface IRegionManagerAccessor /// Gets the value for the RegionName attached property. /// /// The object to adapt. This is typically a container (i.e a control). - /// The name of the region that should be created when + /// The name of the region that should be created when /// the RegionManager is also set in this element. string GetRegionName(VisualElement element); diff --git a/src/Forms/Prism.Forms.Regions/Regions/ItemMetadata.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/ItemMetadata.cs similarity index 98% rename from src/Forms/Prism.Forms.Regions/Regions/ItemMetadata.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/ItemMetadata.cs index 713d8895ab..d775f43a18 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/ItemMetadata.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/ItemMetadata.cs @@ -1,7 +1,7 @@ using System; using Xamarin.Forms; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines a class that wraps an item and adds metadata for it. diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationContentLoader.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Navigation/RegionNavigationContentLoader.cs similarity index 99% rename from src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationContentLoader.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Navigation/RegionNavigationContentLoader.cs index 83d727427f..4d1ff1c736 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationContentLoader.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Navigation/RegionNavigationContentLoader.cs @@ -8,7 +8,7 @@ using Prism.Properties; using Xamarin.Forms; -namespace Prism.Regions.Navigation +namespace Prism.Navigation.Regions.Navigation { /// /// Implementation of that relies on a diff --git a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationService.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Navigation/RegionNavigationService.cs similarity index 99% rename from src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationService.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Navigation/RegionNavigationService.cs index 80f1791f53..122e2c14bf 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Navigation/RegionNavigationService.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Navigation/RegionNavigationService.cs @@ -2,12 +2,10 @@ using System.Linq; using Prism.Common; using Prism.Ioc; -using Prism.Navigation; using Prism.Properties; -using Prism.Regions; using Xamarin.Forms; -namespace Prism.Regions.Navigation +namespace Prism.Navigation.Regions.Navigation { /// /// Provides navigation for regions. diff --git a/src/Forms/Prism.Forms.Regions/Regions/Region.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Region.cs similarity index 99% rename from src/Forms/Prism.Forms.Regions/Regions/Region.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Region.cs index ccf7cdeb81..9ac413648f 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Region.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Region.cs @@ -4,11 +4,10 @@ using System.Linq; using Prism.Ioc; using Prism.Mvvm; -using Prism.Navigation; using Prism.Properties; using Xamarin.Forms; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Implementation of that allows multiple active views. diff --git a/src/Forms/Prism.Forms.Regions/Regions/RegionCollection.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionCollection.cs similarity index 98% rename from src/Forms/Prism.Forms.Regions/Regions/RegionCollection.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionCollection.cs index c9e2516ab7..378f6d2d95 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/RegionCollection.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionCollection.cs @@ -6,7 +6,7 @@ using System.Linq; using Prism.Properties; -namespace Prism.Regions +namespace Prism.Navigation.Regions { internal class RegionCollection : IRegionCollection { @@ -66,7 +66,7 @@ public void Add(IRegion region) } _regions.Add(region); - region.RegionManager = this.regionManager; + region.RegionManager = regionManager; OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, region, 0)); } diff --git a/src/Forms/Prism.Forms.Regions/Regions/RegionContext.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionContext.cs similarity index 96% rename from src/Forms/Prism.Forms.Regions/Regions/RegionContext.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionContext.cs index b0456ed29c..cbc5ad20a1 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/RegionContext.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionContext.cs @@ -1,9 +1,9 @@ using System; using Prism.Common; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions.Behaviors; using Xamarin.Forms; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Class that holds methods to Set and Get the RegionContext from a BindableObject. diff --git a/src/Forms/Prism.Forms.Regions/Regions/RegionManager.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionManager.cs similarity index 99% rename from src/Forms/Prism.Forms.Regions/Regions/RegionManager.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionManager.cs index 1cd77e8455..81822c539a 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/RegionManager.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/RegionManager.cs @@ -4,11 +4,10 @@ using Prism.Common; using Prism.Ioc; using Prism.Ioc.Internals; -using Prism.Navigation; using Prism.Properties; using Xamarin.Forms; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// This class is responsible for maintaining a collection of regions and attaching regions to controls. diff --git a/src/Forms/Prism.Forms.Regions/Regions/SingleActiveRegion.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/SingleActiveRegion.cs similarity index 96% rename from src/Forms/Prism.Forms.Regions/Regions/SingleActiveRegion.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/SingleActiveRegion.cs index fa851d0ae2..7eaea78410 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/SingleActiveRegion.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/SingleActiveRegion.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Region that allows a maximum of one active view at a time. diff --git a/src/Forms/Prism.Forms.Regions/Regions/ViewsCollection.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/ViewsCollection.cs similarity index 92% rename from src/Forms/Prism.Forms.Regions/Regions/ViewsCollection.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/ViewsCollection.cs index 53ae7315e3..51b29b2c26 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/ViewsCollection.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/ViewsCollection.cs @@ -7,7 +7,7 @@ using Prism.Mvvm; using Xamarin.Forms; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Implementation of that takes an of @@ -83,7 +83,7 @@ public Comparison SortComparison /// IEnumerator IEnumerable.GetEnumerator() { - return this.GetEnumerator(); + return GetEnumerator(); } /// @@ -125,12 +125,12 @@ private void MonitorAllMetadataItems() /// private void RemoveAllMetadataMonitors() { - foreach (var item in this._monitoredItems) + foreach (var item in _monitoredItems) { - item.Key.MetadataChanged -= this.OnItemMetadataChanged; + item.Key.MetadataChanged -= OnItemMetadataChanged; } - this._monitoredItems.Clear(); + _monitoredItems.Clear(); } /// @@ -174,7 +174,7 @@ private void OnItemMetadataChanged(object sender, EventArgs e) bool foundInfo = _monitoredItems.TryGetValue(itemMetadata, out MonitorInfo monitorInfo); if (!foundInfo) return; - if (this.Filter(itemMetadata)) + if (Filter(itemMetadata)) { if (!monitorInfo.IsInList) { @@ -182,7 +182,7 @@ private void OnItemMetadataChanged(object sender, EventArgs e) // as in our list so we can consider this // an Add. monitorInfo.IsInList = true; - this.UpdateFilteredItemsList(); + UpdateFilteredItemsList(); NotifyAdd(itemMetadata.Item); } } @@ -192,7 +192,7 @@ private void OnItemMetadataChanged(object sender, EventArgs e) // tracking list, but should not remove any monitoring in // case it fits our filter in the future. monitorInfo.IsInList = false; - this.RemoveFromFilteredList(itemMetadata.Item); + RemoveFromFilteredList(itemMetadata.Item); } } @@ -218,11 +218,11 @@ private void SourceCollectionChanged(object sender, NotifyCollectionChangedEvent } // If we're sorting we can't predict how - // the collection has changed on an add so we + // the collection has changed on an add so we // resort to a reset notification. if (SortComparison != null) { - this.NotifyReset(); + NotifyReset(); } break; @@ -230,19 +230,19 @@ private void SourceCollectionChanged(object sender, NotifyCollectionChangedEvent case NotifyCollectionChangedAction.Remove: foreach (ItemMetadata itemMetadata in e.OldItems) { - this.RemoveMetadataMonitor(itemMetadata); - if (this.Filter(itemMetadata)) + RemoveMetadataMonitor(itemMetadata); + if (Filter(itemMetadata)) { - this.RemoveFromFilteredList(itemMetadata.Item); + RemoveFromFilteredList(itemMetadata.Item); } } break; default: - this.ResetAllMonitors(); - this.UpdateFilteredItemsList(); - this.NotifyReset(); + ResetAllMonitors(); + UpdateFilteredItemsList(); + NotifyReset(); break; } @@ -283,12 +283,12 @@ public RegionItemComparer(Comparison comparer) public override int Compare(VisualElement x, VisualElement y) { - if (this.comparer == null) + if (comparer == null) { return 0; } - return this.comparer(x, y); + return comparer(x, y); } } diff --git a/src/Forms/Prism.Forms.Regions/Regions/Xaml/RegionManager.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Xaml/RegionManager.cs similarity index 98% rename from src/Forms/Prism.Forms.Regions/Regions/Xaml/RegionManager.cs rename to src/Forms/Prism.Forms.Regions/Navigation/Regions/Xaml/RegionManager.cs index c96c67320c..5e289db8aa 100644 --- a/src/Forms/Prism.Forms.Regions/Regions/Xaml/RegionManager.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Xaml/RegionManager.cs @@ -4,12 +4,12 @@ using Prism.Common; using Prism.Events; using Prism.Ioc; +using Prism.Navigation.Regions.Adapters; +using Prism.Navigation.Regions.Behaviors; using Prism.Properties; -using Prism.Regions.Adapters; -using Prism.Regions.Behaviors; using Xamarin.Forms; -namespace Prism.Regions.Xaml +namespace Prism.Navigation.Regions.Xaml { /// /// A class to provide Bindable Properties and helpers for Regions. diff --git a/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj b/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj index 6fc5b9c8d3..180804026f 100644 --- a/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj +++ b/src/Forms/Prism.Forms.Regions/Prism.Forms.Regions.csproj @@ -13,13 +13,13 @@ Prism.Forms.Regions helps you more easily design and build rich, flexible, and e - - - - - - - + + + + + + + True True diff --git a/src/Forms/Prism.Forms.Regions/Properties/AssemblyInfo.cs b/src/Forms/Prism.Forms.Regions/Properties/AssemblyInfo.cs index 1e8f340bba..eb1b0599f0 100644 --- a/src/Forms/Prism.Forms.Regions/Properties/AssemblyInfo.cs +++ b/src/Forms/Prism.Forms.Regions/Properties/AssemblyInfo.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; using Xamarin.Forms; -[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Regions.Xaml")] +[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Navigation.Regions.Xaml")] [assembly: InternalsVisibleTo("Prism.Forms.Regions.Tests")] diff --git a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs index 52c26bdf0a..2d91c56c4f 100644 --- a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs +++ b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs @@ -2,8 +2,7 @@ using System.Reflection; using Prism.Navigation; using Prism.Navigation.Xaml; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; using NavigationMode = Prism.Navigation.NavigationMode; using TabbedPage = Microsoft.Maui.Controls.TabbedPage; diff --git a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs index 5ea94814b0..00d85a4692 100644 --- a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs +++ b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs @@ -1,9 +1,10 @@ using Microsoft.Maui.Controls.Compatibility; using Prism.Mvvm; -using Prism.Regions; -using Prism.Regions.Adapters; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Adapters; +using Prism.Navigation.Regions.Behaviors; +using Prism.Navigation.Regions.Navigation; +using Prism.Navigation.Regions; namespace Prism.Ioc; @@ -19,7 +20,7 @@ public static class RegionNavigationRegistrationExtensions /// used to register type for Navigation. /// The unique name to register with the View public static IContainerRegistry RegisterForRegionNavigation(this IContainerRegistry containerRegistry, string name = null) - where TView : View => + where TView : View => containerRegistry.RegisterForNavigationWithViewModel(typeof(TView), null, name); /// @@ -31,7 +32,7 @@ public static IContainerRegistry RegisterForRegionNavigation(this IContai /// public static IContainerRegistry RegisterForRegionNavigation(this IContainerRegistry containerRegistry, string name = null) where TView : View - where TViewModel : class => + where TViewModel : class => containerRegistry.RegisterForNavigationWithViewModel(typeof(TView), typeof(TViewModel), name); private static IContainerRegistry RegisterForNavigationWithViewModel(this IContainerRegistry containerRegistry, Type viewType, Type viewModelType, string name) @@ -41,7 +42,7 @@ private static IContainerRegistry RegisterForNavigationWithViewModel(this IConta if (viewModelType is not null) containerRegistry.Register(viewModelType); - + containerRegistry.Register(viewType) .RegisterInstance(new ViewRegistration { diff --git a/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs b/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs index e9105c42ac..952fb528b6 100644 --- a/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs +++ b/src/Maui/Prism.Maui/Navigation/Internals/ChildRegionCollection.cs @@ -1,5 +1,5 @@ using System.Collections; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Navigation.Internals; diff --git a/src/Maui/Prism.Maui/Regions/Adapters/CarouselViewRegionAdapter.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/CarouselViewRegionAdapter.cs similarity index 97% rename from src/Maui/Prism.Maui/Regions/Adapters/CarouselViewRegionAdapter.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/CarouselViewRegionAdapter.cs index de3f208228..f224413efe 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/CarouselViewRegionAdapter.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/CarouselViewRegionAdapter.cs @@ -4,10 +4,8 @@ using Prism.Ioc; using Prism.Mvvm; using Prism.Properties; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Adapter that creates a new and monitors its @@ -114,7 +112,7 @@ private void OnCurrentItemChanged(object sender, CurrentItemChangedEventArgs e) } var name = newActiveView.GetValue(ViewModelLocator.NavigationNameProperty) as string; - if(string.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { var viewType = newActiveView.GetType(); var registry = _region.Container().Resolve(); diff --git a/src/Maui/Prism.Maui/Regions/Adapters/CollectionViewRegionAdapter.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/CollectionViewRegionAdapter.cs similarity index 96% rename from src/Maui/Prism.Maui/Regions/Adapters/CollectionViewRegionAdapter.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/CollectionViewRegionAdapter.cs index 17659fec83..334342ab72 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/CollectionViewRegionAdapter.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/CollectionViewRegionAdapter.cs @@ -1,8 +1,7 @@ using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Adapter that creates a new and monitors its diff --git a/src/Maui/Prism.Maui/Regions/Adapters/ContentViewRegionAdapter.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/ContentViewRegionAdapter.cs similarity index 88% rename from src/Maui/Prism.Maui/Regions/Adapters/ContentViewRegionAdapter.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/ContentViewRegionAdapter.cs index 5b110f0049..2aa73775ea 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/ContentViewRegionAdapter.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/ContentViewRegionAdapter.cs @@ -1,7 +1,4 @@ -using Prism.Ioc; -using Prism.Regions.Behaviors; - -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Adapter that creates a new and monitors its diff --git a/src/Maui/Prism.Maui/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs similarity index 97% rename from src/Maui/Prism.Maui/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs index 45b6aa7a6c..3ba29e628f 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/ContentViewRegionAdapter{TContentView}.cs @@ -1,9 +1,8 @@ using System.Collections.Specialized; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Adapter that creates a new and monitors its diff --git a/src/Maui/Prism.Maui/Regions/Adapters/IRegionAdapter.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/IRegionAdapter.cs similarity index 92% rename from src/Maui/Prism.Maui/Regions/Adapters/IRegionAdapter.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/IRegionAdapter.cs index 8759ea4c7e..e32c3dc7d6 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/IRegionAdapter.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/IRegionAdapter.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Defines an interfaces to adapt an object and bind it to a new . diff --git a/src/Maui/Prism.Maui/Regions/Adapters/LayoutViewRegionAdapter.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/LayoutViewRegionAdapter.cs similarity index 96% rename from src/Maui/Prism.Maui/Regions/Adapters/LayoutViewRegionAdapter.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/LayoutViewRegionAdapter.cs index d5cb11f18f..07f48a0f93 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/LayoutViewRegionAdapter.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/LayoutViewRegionAdapter.cs @@ -1,9 +1,8 @@ using Microsoft.Maui.Controls.Compatibility; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Adapter that creates a new and monitors its diff --git a/src/Maui/Prism.Maui/Regions/Adapters/RegionAdapterBase.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionAdapterBase.cs similarity index 98% rename from src/Maui/Prism.Maui/Regions/Adapters/RegionAdapterBase.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionAdapterBase.cs index 9bd9bf9957..c803e66cc4 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/RegionAdapterBase.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionAdapterBase.cs @@ -1,12 +1,11 @@ using System.Globalization; using Prism.Extensions; using Prism.Ioc; +using Prism.Navigation.Regions.Behaviors; using Prism.Navigation.Xaml; using Prism.Properties; -using Prism.Regions.Behaviors; -using XamlNavigation = Prism.Navigation.Xaml.Navigation; -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Base class to facilitate the creation of implementations. diff --git a/src/Maui/Prism.Maui/Regions/Adapters/RegionAdapterMappings.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionAdapterMappings.cs similarity index 99% rename from src/Maui/Prism.Maui/Regions/Adapters/RegionAdapterMappings.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionAdapterMappings.cs index 404a069d07..41e1953e73 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/RegionAdapterMappings.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionAdapterMappings.cs @@ -2,7 +2,7 @@ using Prism.Ioc; using Prism.Properties; -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// This class maps with . diff --git a/src/Maui/Prism.Maui/Regions/Adapters/RegionItemsSourceTemplate.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionItemsSourceTemplate.cs similarity index 92% rename from src/Maui/Prism.Maui/Regions/Adapters/RegionItemsSourceTemplate.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionItemsSourceTemplate.cs index fb1875a6c3..50d6651658 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/RegionItemsSourceTemplate.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/RegionItemsSourceTemplate.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; // Implementation Note: // In discussing with PureWeen, it is best to provide a ContentView and provide a diff --git a/src/Maui/Prism.Maui/Regions/Adapters/ScrollViewRegionAdapter.cs b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/ScrollViewRegionAdapter.cs similarity index 96% rename from src/Maui/Prism.Maui/Regions/Adapters/ScrollViewRegionAdapter.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Adapters/ScrollViewRegionAdapter.cs index f37c258f1d..53a58f95e3 100644 --- a/src/Maui/Prism.Maui/Regions/Adapters/ScrollViewRegionAdapter.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Adapters/ScrollViewRegionAdapter.cs @@ -1,9 +1,8 @@ using System.Collections.Specialized; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; -namespace Prism.Regions.Adapters; +namespace Prism.Navigation.Regions.Adapters; /// /// Adapter that creates a new and monitors its @@ -57,4 +56,4 @@ protected override void Adapt(IRegion region, ScrollView regionTarget) /// A new instance of . protected override IRegion CreateRegion(IContainerProvider container) => container.Resolve(); -} \ No newline at end of file +} diff --git a/src/Maui/Prism.Maui/Regions/AllActiveRegion.cs b/src/Maui/Prism.Maui/Navigation/Regions/AllActiveRegion.cs similarity index 96% rename from src/Maui/Prism.Maui/Regions/AllActiveRegion.cs rename to src/Maui/Prism.Maui/Navigation/Regions/AllActiveRegion.cs index f7dc459d20..aa3d4bdce3 100644 --- a/src/Maui/Prism.Maui/Regions/AllActiveRegion.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/AllActiveRegion.cs @@ -1,6 +1,6 @@ using Prism.Properties; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Region that keeps all the views in it as active. Deactivation of views is not allowed. @@ -11,7 +11,7 @@ public class AllActiveRegion : Region /// Creates a new . /// /// - public AllActiveRegion(IRegionNavigationService regionNavigationService) + public AllActiveRegion(IRegionNavigationService regionNavigationService) : base(regionNavigationService) { } diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/AutoPopulateRegionBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs similarity index 96% rename from src/Maui/Prism.Maui/Regions/Behaviors/AutoPopulateRegionBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs index 7f21f945f2..5f2b4397a8 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/AutoPopulateRegionBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs @@ -1,7 +1,7 @@ using System.ComponentModel; using Prism.Ioc; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// /// Populates the target region with the views registered to it in the . @@ -54,12 +54,12 @@ private void StartPopulatingContent() Region.Add(targetName); else if (defaultView is VisualElement element) Region.Add(element); - else if(defaultView is Type type) + else if (defaultView is Type type) { var container = targetAware.Container; var registry = container.Resolve(); var registration = registry.Registrations.FirstOrDefault(x => x.View == type); - if(registration is not null) + if (registration is not null) { var view = registry.CreateView(container, registration.Name) as VisualElement; Region.Add(view); diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs similarity index 97% rename from src/Maui/Prism.Maui/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs index 808bdd6589..ba8aa841d7 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/BindRegionContextToVisualElementBehavior.cs @@ -3,10 +3,10 @@ using System.ComponentModel; using Prism.Common; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// -/// Defines a behavior that forwards the +/// Defines a behavior that forwards the /// to the views in the region. /// public class BindRegionContextToVisualElementBehavior : IRegionBehavior diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/ClearChildViewsRegionBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs similarity index 88% rename from src/Maui/Prism.Maui/Regions/Behaviors/ClearChildViewsRegionBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs index c47c77846a..1e1c934c38 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/ClearChildViewsRegionBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// /// Behavior that removes the RegionManager attached property of all the views in a region once the RegionManager property of a region becomes null. @@ -31,7 +31,7 @@ public static bool GetClearChildViews(BindableObject target) if (target == null) throw new ArgumentNullException(nameof(target)); - return (bool)target.GetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty); + return (bool)target.GetValue(ClearChildViewsProperty); } /// @@ -44,7 +44,7 @@ public static void SetClearChildViews(BindableObject target, bool value) if (target == null) throw new ArgumentNullException(nameof(target)); - target.SetValue(ClearChildViewsRegionBehavior.ClearChildViewsProperty, value); + target.SetValue(ClearChildViewsProperty, value); } /// @@ -52,7 +52,7 @@ public static void SetClearChildViews(BindableObject target, bool value) /// protected override void OnAttach() { - this.Region.PropertyChanged += Region_PropertyChanged; + Region.PropertyChanged += Region_PropertyChanged; } private static void ClearChildViews(IRegion region) @@ -70,9 +70,9 @@ private void Region_PropertyChanged(object sender, System.ComponentModel.Propert { if (e.PropertyName == "RegionManager") { - if (this.Region.RegionManager == null) + if (Region.RegionManager == null) { - ClearChildViews(this.Region); + ClearChildViews(Region); } } } diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/DelayedRegionCreationBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs similarity index 96% rename from src/Maui/Prism.Maui/Regions/Behaviors/DelayedRegionCreationBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs index 1d99e0f6d0..a70aba6ee6 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/DelayedRegionCreationBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs @@ -2,13 +2,11 @@ using System.Globalization; using Prism.Behaviors; using Prism.Extensions; -using Prism.Ioc; +using Prism.Navigation.Regions.Adapters; using Prism.Navigation.Xaml; using Prism.Properties; -using Prism.Regions.Adapters; -using XamlNavigation = Prism.Navigation.Xaml.Navigation; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// /// Behavior that creates a new , when the control that will host the (see ) @@ -85,7 +83,7 @@ public void Detach() /// Called when the is updating it's collection. /// /// The . - /// The instance containing the event data. + /// The instance containing the event data. public void OnUpdatingRegions(object sender, EventArgs e) { TryCreateRegion(); diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/DestructibleRegionBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs similarity index 94% rename from src/Maui/Prism.Maui/Regions/Behaviors/DestructibleRegionBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs index d785e72a93..68e3732cf3 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/DestructibleRegionBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs @@ -1,8 +1,7 @@ using System.Collections.Specialized; using Prism.Common; -using Prism.Navigation; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// /// Provides a Behavior to Destroy the View/ViewModel when the View is removed from the Region's Views diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/IHostAwareRegionBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs similarity index 92% rename from src/Maui/Prism.Maui/Regions/Behaviors/IHostAwareRegionBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs index 4cd576c7ae..d55a38cd8c 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/IHostAwareRegionBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// /// Defines a that not allows extensible behaviors on regions which also interact diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionActiveAwareBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs similarity index 86% rename from src/Maui/Prism.Maui/Regions/Behaviors/RegionActiveAwareBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs index 7d39ca2bf2..a61667e9b4 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionActiveAwareBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs @@ -1,17 +1,17 @@ using System.Collections.Specialized; using Prism.Common; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// -/// Behavior that monitors a object and +/// Behavior that monitors a object and /// changes the value for the property when -/// an object that implements gets added or removed +/// an object that implements gets added or removed /// from the collection. /// /// /// This class can also sync the active state for any scoped regions directly on the view based on the . -/// If you use the method with the createRegionManagerScope option, the scoped manager will be attached to the view. +/// If you use the method with the createRegionManagerScope option, the scoped manager will be attached to the view. /// public class RegionActiveAwareBehavior : IRegionBehavior { @@ -30,7 +30,7 @@ public class RegionActiveAwareBehavior : IRegionBehavior /// public void Attach() { - INotifyCollectionChanged collection = this.GetCollection(); + INotifyCollectionChanged collection = GetCollection(); if (collection != null) { collection.CollectionChanged += OnCollectionChanged; @@ -42,7 +42,7 @@ public void Attach() /// public void Detach() { - INotifyCollectionChanged collection = this.GetCollection(); + INotifyCollectionChanged collection = GetCollection(); if (collection != null) { collection.CollectionChanged -= OnCollectionChanged; @@ -79,13 +79,13 @@ private void InvokeOnSynchronizedActiveAwareChildren(object item, Action e.ActiveViews); @@ -112,6 +112,6 @@ private bool ShouldSyncActiveState(VisualElement view) private INotifyCollectionChanged GetCollection() { - return this.Region.ActiveViews; + return Region.ActiveViews; } } diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionCreationException.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionCreationException.cs similarity index 94% rename from src/Maui/Prism.Maui/Regions/Behaviors/RegionCreationException.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionCreationException.cs index ee5ba2453d..54c0c3e0ee 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionCreationException.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionCreationException.cs @@ -1,9 +1,9 @@ using System.Runtime.Serialization; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// -/// Represents errors that occured during region creation. +/// Represents errors that occurred during region creation. /// [Serializable] public partial class RegionCreationException : Exception @@ -45,4 +45,4 @@ protected RegionCreationException(SerializationInfo info, StreamingContext conte : base(info, context) { } -} \ No newline at end of file +} diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionManagerRegistrationBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs similarity index 95% rename from src/Maui/Prism.Maui/Regions/Behaviors/RegionManagerRegistrationBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs index 94631f2948..b7e71ae275 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionManagerRegistrationBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs @@ -1,7 +1,7 @@ using System.ComponentModel; using Prism.Properties; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// /// Subscribes to a static event from the in order to register the target @@ -107,7 +107,7 @@ private void TryRegisterRegion() } /// - /// This event handler gets called when a RegionManager is requering the instances of a region to be registered if they are not already. + /// This event handler gets called when a RegionManager is requiring the instances of a region to be registered if they are not already. /// Although this is a public method to support Weak Delegates in Silverlight, it should not be called by the user. /// /// The sender. @@ -121,10 +121,10 @@ private IRegionManager FindRegionManager(Element element) { if (element is VisualElement visualElement) { - var regionmanager = RegionManagerAccessor.GetRegionManager(visualElement); - if (regionmanager != null) + var regionManager = RegionManagerAccessor.GetRegionManager(visualElement); + if (regionManager != null) { - return regionmanager; + return regionManager; } } diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/RegionMemberLifetimeBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs similarity index 97% rename from src/Maui/Prism.Maui/Regions/Behaviors/RegionMemberLifetimeBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs index b5e9a33231..61f8d53a79 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/RegionMemberLifetimeBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs @@ -1,7 +1,7 @@ using System.Collections.Specialized; using Prism.Common; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; /// /// The RegionMemberLifetimeBehavior determines if items should be removed from the @@ -9,10 +9,10 @@ namespace Prism.Regions.Behaviors; /// /// /// The monitors the -/// collection to discover items that transition into a deactivated state. +/// collection to discover items that transition into a deactivated state. ///

/// The behavior checks the removed items for either the -/// or the (in that order) to determine if it should be kept +/// or the (in that order) to determine if it should be kept /// alive on removal. ///

/// If the item in the collection is a , it will diff --git a/src/Maui/Prism.Maui/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs similarity index 92% rename from src/Maui/Prism.Maui/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs index 430d3615b1..965657d38b 100644 --- a/src/Maui/Prism.Maui/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs @@ -1,14 +1,14 @@ using Prism.Common; using Prism.Properties; -namespace Prism.Regions.Behaviors; +namespace Prism.Navigation.Regions.Behaviors; ///

-/// Behavior that synchronizes the property of a with -/// the control that hosts the Region. It does this by setting the +/// Behavior that synchronizes the property of a with +/// the control that hosts the Region. It does this by setting the /// Dependency Property on the host control. -/// -/// This behavior allows the usage of two way databinding of the RegionContext from XAML. +/// +/// This behavior allows the usage of two way databinding of the RegionContext from XAML. /// public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegionBehavior { @@ -16,7 +16,7 @@ public class SyncRegionContextWithHostBehavior : RegionBehavior, IHostAwareRegio private VisualElement _hostControl; /// - /// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors. + /// Name that identifies the SyncRegionContextWithHostBehavior behavior in a collection of RegionsBehaviors. /// public static readonly string BehaviorKey = "SyncRegionContextWithHost"; @@ -52,7 +52,7 @@ protected override void OnAttach() { if (HostControl != null) { - // Sync values initially. + // Sync values initially. SynchronizeRegionContext(); // Now register for events to keep them in sync diff --git a/src/Maui/Prism.Maui/Regions/DefaultRegionManagerAccessor.cs b/src/Maui/Prism.Maui/Navigation/Regions/DefaultRegionManagerAccessor.cs similarity index 98% rename from src/Maui/Prism.Maui/Regions/DefaultRegionManagerAccessor.cs rename to src/Maui/Prism.Maui/Navigation/Regions/DefaultRegionManagerAccessor.cs index d492ae093c..32e810ae59 100644 --- a/src/Maui/Prism.Maui/Regions/DefaultRegionManagerAccessor.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/DefaultRegionManagerAccessor.cs @@ -1,6 +1,6 @@ using Prism.Ioc; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; internal class DefaultRegionManagerAccessor : IRegionManagerAccessor { diff --git a/src/Maui/Prism.Maui/Regions/IRegionManagerAccessor.cs b/src/Maui/Prism.Maui/Navigation/Regions/IRegionManagerAccessor.cs similarity index 96% rename from src/Maui/Prism.Maui/Regions/IRegionManagerAccessor.cs rename to src/Maui/Prism.Maui/Navigation/Regions/IRegionManagerAccessor.cs index 3ae2eb4d63..fd5316c0fe 100644 --- a/src/Maui/Prism.Maui/Regions/IRegionManagerAccessor.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/IRegionManagerAccessor.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Provides an abstraction on top of the RegionManager static members. @@ -16,7 +16,7 @@ public interface IRegionManagerAccessor /// Gets the value for the RegionName attached property. /// /// The object to adapt. This is typically a container (i.e a control). - /// The name of the region that should be created when + /// The name of the region that should be created when /// the RegionManager is also set in this element. string GetRegionName(VisualElement element); diff --git a/src/Maui/Prism.Maui/Regions/IRegionMemberLifetime.cs b/src/Maui/Prism.Maui/Navigation/Regions/IRegionMemberLifetime.cs similarity index 85% rename from src/Maui/Prism.Maui/Regions/IRegionMemberLifetime.cs rename to src/Maui/Prism.Maui/Navigation/Regions/IRegionMemberLifetime.cs index 8cf44e9f1a..3333c4a974 100644 --- a/src/Maui/Prism.Maui/Regions/IRegionMemberLifetime.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/IRegionMemberLifetime.cs @@ -1,6 +1,6 @@ -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions.Behaviors; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// When implemented, allows an instance placed in a diff --git a/src/Maui/Prism.Maui/Regions/ITargetAwareRegion.cs b/src/Maui/Prism.Maui/Navigation/Regions/ITargetAwareRegion.cs similarity index 88% rename from src/Maui/Prism.Maui/Regions/ITargetAwareRegion.cs rename to src/Maui/Prism.Maui/Navigation/Regions/ITargetAwareRegion.cs index 4a809b6005..563a312466 100644 --- a/src/Maui/Prism.Maui/Regions/ITargetAwareRegion.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/ITargetAwareRegion.cs @@ -2,11 +2,12 @@ using Prism.Ioc; using Prism.Navigation.Xaml; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; [EditorBrowsable(EditorBrowsableState.Never)] public interface ITargetAwareRegion : IRegion { VisualElement TargetElement { get; set; } + IContainerProvider Container => TargetElement.GetContainerProvider(); } diff --git a/src/Maui/Prism.Maui/Regions/ItemMetadata.cs b/src/Maui/Prism.Maui/Navigation/Regions/ItemMetadata.cs similarity index 98% rename from src/Maui/Prism.Maui/Regions/ItemMetadata.cs rename to src/Maui/Prism.Maui/Navigation/Regions/ItemMetadata.cs index 5c0b68c509..adb151bc21 100644 --- a/src/Maui/Prism.Maui/Regions/ItemMetadata.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/ItemMetadata.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Defines a class that wraps an item and adds metadata for it. diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationContentLoader.cs b/src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationContentLoader.cs similarity index 98% rename from src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationContentLoader.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationContentLoader.cs index ab89676305..8940098965 100644 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationContentLoader.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationContentLoader.cs @@ -4,7 +4,7 @@ using Prism.Mvvm; using Prism.Properties; -namespace Prism.Regions.Navigation; +namespace Prism.Navigation.Regions.Navigation; /// /// Implementation of that relies on a @@ -120,7 +120,7 @@ protected virtual IEnumerable GetCandidatesFromRegion(IRegion reg { var registry = region.Container().Resolve(); var registration = registry.Registrations.FirstOrDefault(x => x.Type == ViewType.Region && (x.Name == candidateNavigationContract || x.View.Name == candidateNavigationContract || x.View.FullName == candidateNavigationContract)); - if(registration is null) + if (registration is null) { GetCandidatesFromRegionViews(region, registration.View.FullName); } diff --git a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationService.cs b/src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationService.cs similarity index 99% rename from src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationService.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationService.cs index 1df06691a3..44d4691650 100644 --- a/src/Maui/Prism.Maui/Regions/Navigation/RegionNavigationService.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Navigation/RegionNavigationService.cs @@ -1,9 +1,8 @@ using Prism.Common; using Prism.Ioc; -using Prism.Navigation; using Prism.Properties; -namespace Prism.Regions.Navigation; +namespace Prism.Navigation.Regions.Navigation; /// /// Provides navigation for regions. diff --git a/src/Maui/Prism.Maui/Regions/Region.cs b/src/Maui/Prism.Maui/Navigation/Regions/Region.cs similarity index 99% rename from src/Maui/Prism.Maui/Regions/Region.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Region.cs index 983cd87afc..699bc946ed 100644 --- a/src/Maui/Prism.Maui/Regions/Region.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Region.cs @@ -2,11 +2,10 @@ using System.Globalization; using Prism.Ioc; using Prism.Mvvm; -using Prism.Navigation; using Prism.Navigation.Xaml; using Prism.Properties; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Implementation of that allows multiple active views. diff --git a/src/Maui/Prism.Maui/Regions/RegionCollection.cs b/src/Maui/Prism.Maui/Navigation/Regions/RegionCollection.cs similarity index 97% rename from src/Maui/Prism.Maui/Regions/RegionCollection.cs rename to src/Maui/Prism.Maui/Navigation/Regions/RegionCollection.cs index e5b645fabb..8d44e9be41 100644 --- a/src/Maui/Prism.Maui/Regions/RegionCollection.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/RegionCollection.cs @@ -3,7 +3,7 @@ using System.Globalization; using Prism.Properties; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; internal class RegionCollection : IRegionCollection { @@ -63,7 +63,7 @@ public void Add(IRegion region) } _regions.Add(region); - region.RegionManager = this.regionManager; + region.RegionManager = regionManager; OnCollectionChanged(new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, region, 0)); } diff --git a/src/Maui/Prism.Maui/Regions/RegionContext.cs b/src/Maui/Prism.Maui/Navigation/Regions/RegionContext.cs similarity index 95% rename from src/Maui/Prism.Maui/Regions/RegionContext.cs rename to src/Maui/Prism.Maui/Navigation/Regions/RegionContext.cs index 9d9460563b..a476a67377 100644 --- a/src/Maui/Prism.Maui/Regions/RegionContext.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/RegionContext.cs @@ -1,7 +1,7 @@ using Prism.Common; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions.Behaviors; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Class that holds methods to Set and Get the RegionContext from a BindableObject. diff --git a/src/Maui/Prism.Maui/Regions/RegionExtensions.cs b/src/Maui/Prism.Maui/Navigation/Regions/RegionExtensions.cs similarity index 90% rename from src/Maui/Prism.Maui/Regions/RegionExtensions.cs rename to src/Maui/Prism.Maui/Navigation/Regions/RegionExtensions.cs index 7160585673..a29b3f4130 100644 --- a/src/Maui/Prism.Maui/Regions/RegionExtensions.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/RegionExtensions.cs @@ -1,6 +1,6 @@ using Prism.Ioc; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; internal static class RegionExtensions { diff --git a/src/Maui/Prism.Maui/Regions/RegionManager.cs b/src/Maui/Prism.Maui/Navigation/Regions/RegionManager.cs similarity index 99% rename from src/Maui/Prism.Maui/Regions/RegionManager.cs rename to src/Maui/Prism.Maui/Navigation/Regions/RegionManager.cs index 76c366c1fb..2abb34282c 100644 --- a/src/Maui/Prism.Maui/Regions/RegionManager.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/RegionManager.cs @@ -1,8 +1,7 @@ using Prism.Ioc; -using Prism.Navigation; using Prism.Properties; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// This class is responsible for maintaining a collection of regions and attaching regions to controls. diff --git a/src/Maui/Prism.Maui/Regions/RegionNavigationRegistry.cs b/src/Maui/Prism.Maui/Navigation/Regions/RegionNavigationRegistry.cs similarity index 91% rename from src/Maui/Prism.Maui/Regions/RegionNavigationRegistry.cs rename to src/Maui/Prism.Maui/Navigation/Regions/RegionNavigationRegistry.cs index 8765ef9685..2de2c7d4c6 100644 --- a/src/Maui/Prism.Maui/Regions/RegionNavigationRegistry.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/RegionNavigationRegistry.cs @@ -1,7 +1,7 @@ using Prism.Ioc; using Prism.Mvvm; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; internal class RegionNavigationRegistry : ViewRegistryBase, IRegionNavigationRegistry { diff --git a/src/Maui/Prism.Maui/Regions/RegionViewRegistry.cs b/src/Maui/Prism.Maui/Navigation/Regions/RegionViewRegistry.cs similarity index 97% rename from src/Maui/Prism.Maui/Regions/RegionViewRegistry.cs rename to src/Maui/Prism.Maui/Navigation/Regions/RegionViewRegistry.cs index dc2695c214..c3a04bf33d 100644 --- a/src/Maui/Prism.Maui/Regions/RegionViewRegistry.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/RegionViewRegistry.cs @@ -6,15 +6,15 @@ using Prism.Mvvm; using Prism.Properties; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Defines a registry for the content of the regions used on View Discovery composition. /// public class RegionViewRegistry : IRegionViewRegistry { - private readonly ListDictionary> _registeredContent = new (); - private readonly WeakDelegatesManager _contentRegisteredListeners = new (); + private readonly ListDictionary> _registeredContent = new(); + private readonly WeakDelegatesManager _contentRegisteredListeners = new(); /// /// Occurs whenever a new view is registered. @@ -75,7 +75,7 @@ public void RegisterViewWithRegion(string regionName, string targetName) } /// - /// Registers a delegate that can be used to retrieve the content associated with a region name. + /// Registers a delegate that can be used to retrieve the content associated with a region name. /// /// Region name to which the will be registered. /// Delegate used to retrieve the content associated with the . diff --git a/src/Maui/Prism.Maui/Regions/SingleActiveRegion.cs b/src/Maui/Prism.Maui/Navigation/Regions/SingleActiveRegion.cs similarity index 94% rename from src/Maui/Prism.Maui/Regions/SingleActiveRegion.cs rename to src/Maui/Prism.Maui/Navigation/Regions/SingleActiveRegion.cs index dc31b56e26..48c58000cb 100644 --- a/src/Maui/Prism.Maui/Regions/SingleActiveRegion.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/SingleActiveRegion.cs @@ -1,6 +1,4 @@ -using Prism.Regions.Navigation; - -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Region that allows a maximum of one active view at a time. diff --git a/src/Maui/Prism.Maui/Regions/ViewsCollection.cs b/src/Maui/Prism.Maui/Navigation/Regions/ViewsCollection.cs similarity index 91% rename from src/Maui/Prism.Maui/Regions/ViewsCollection.cs rename to src/Maui/Prism.Maui/Navigation/Regions/ViewsCollection.cs index e5019eefd6..0d14847bca 100644 --- a/src/Maui/Prism.Maui/Regions/ViewsCollection.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/ViewsCollection.cs @@ -3,7 +3,7 @@ using System.Collections.Specialized; using Prism.Mvvm; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Implementation of that takes an of @@ -79,7 +79,7 @@ public Comparison SortComparison /// IEnumerator IEnumerable.GetEnumerator() { - return this.GetEnumerator(); + return GetEnumerator(); } /// @@ -121,12 +121,12 @@ private void MonitorAllMetadataItems() /// private void RemoveAllMetadataMonitors() { - foreach (var item in this._monitoredItems) + foreach (var item in _monitoredItems) { - item.Key.MetadataChanged -= this.OnItemMetadataChanged; + item.Key.MetadataChanged -= OnItemMetadataChanged; } - this._monitoredItems.Clear(); + _monitoredItems.Clear(); } /// @@ -170,7 +170,7 @@ private void OnItemMetadataChanged(object sender, EventArgs e) bool foundInfo = _monitoredItems.TryGetValue(itemMetadata, out MonitorInfo monitorInfo); if (!foundInfo) return; - if (this.Filter(itemMetadata)) + if (Filter(itemMetadata)) { if (!monitorInfo.IsInList) { @@ -178,7 +178,7 @@ private void OnItemMetadataChanged(object sender, EventArgs e) // as in our list so we can consider this // an Add. monitorInfo.IsInList = true; - this.UpdateFilteredItemsList(); + UpdateFilteredItemsList(); NotifyAdd(itemMetadata.Item); } } @@ -188,7 +188,7 @@ private void OnItemMetadataChanged(object sender, EventArgs e) // tracking list, but should not remove any monitoring in // case it fits our filter in the future. monitorInfo.IsInList = false; - this.RemoveFromFilteredList(itemMetadata.Item); + RemoveFromFilteredList(itemMetadata.Item); } } @@ -214,11 +214,11 @@ private void SourceCollectionChanged(object sender, NotifyCollectionChangedEvent } // If we're sorting we can't predict how - // the collection has changed on an add so we + // the collection has changed on an add so we // resort to a reset notification. if (SortComparison != null) { - this.NotifyReset(); + NotifyReset(); } break; @@ -226,19 +226,19 @@ private void SourceCollectionChanged(object sender, NotifyCollectionChangedEvent case NotifyCollectionChangedAction.Remove: foreach (ItemMetadata itemMetadata in e.OldItems) { - this.RemoveMetadataMonitor(itemMetadata); - if (this.Filter(itemMetadata)) + RemoveMetadataMonitor(itemMetadata); + if (Filter(itemMetadata)) { - this.RemoveFromFilteredList(itemMetadata.Item); + RemoveFromFilteredList(itemMetadata.Item); } } break; default: - this.ResetAllMonitors(); - this.UpdateFilteredItemsList(); - this.NotifyReset(); + ResetAllMonitors(); + UpdateFilteredItemsList(); + NotifyReset(); break; } @@ -279,12 +279,12 @@ public RegionItemComparer(Comparison comparer) public override int Compare(VisualElement x, VisualElement y) { - if (this.comparer == null) + if (comparer == null) { return 0; } - return this.comparer(x, y); + return comparer(x, y); } } diff --git a/src/Maui/Prism.Maui/Regions/Xaml/RegionManager.cs b/src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs similarity index 97% rename from src/Maui/Prism.Maui/Regions/Xaml/RegionManager.cs rename to src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs index 7ef770e2c6..7675c562f2 100644 --- a/src/Maui/Prism.Maui/Regions/Xaml/RegionManager.cs +++ b/src/Maui/Prism.Maui/Navigation/Regions/Xaml/RegionManager.cs @@ -1,15 +1,13 @@ -using System.ComponentModel; -using System.Globalization; +using System.Globalization; using System.Reflection; using Prism.Common; using Prism.Events; -using Prism.Extensions; using Prism.Ioc; +using Prism.Navigation.Regions.Adapters; +using Prism.Navigation.Regions.Behaviors; using Prism.Properties; -using Prism.Regions.Adapters; -using Prism.Regions.Behaviors; -namespace Prism.Regions.Xaml; +namespace Prism.Navigation.Regions.Xaml; /// /// A class to provide Bindable Properties and helpers for Regions. @@ -58,7 +56,7 @@ public static class RegionManager public static readonly BindableProperty DefaultViewProperty = BindableProperty.CreateAttached("DefaultView", typeof(object), typeof(RegionManager), null); - public static void SetDefaultView(VisualElement regionTarget, object viewNameTypeOrInstance) => + public static void SetDefaultView(VisualElement regionTarget, object viewNameTypeOrInstance) => regionTarget.SetValue(DefaultViewProperty, viewNameTypeOrInstance); public static object GetDefaultView(VisualElement regionTarget) => diff --git a/src/Maui/Prism.Maui/PrismAppBuilder.cs b/src/Maui/Prism.Maui/PrismAppBuilder.cs index 15e92de34c..0f872aca8e 100644 --- a/src/Maui/Prism.Maui/PrismAppBuilder.cs +++ b/src/Maui/Prism.Maui/PrismAppBuilder.cs @@ -9,9 +9,9 @@ using Prism.Modularity; using Prism.Mvvm; using Prism.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Adapters; using Prism.Navigation.Xaml; -using Prism.Regions; -using Prism.Regions.Adapters; using Prism.Services; using TabbedPage = Microsoft.Maui.Controls.TabbedPage; diff --git a/src/Maui/Prism.Maui/Properties/AssemblyInfo.cs b/src/Maui/Prism.Maui/Properties/AssemblyInfo.cs index 1436f25f18..0938be8a6b 100644 --- a/src/Maui/Prism.Maui/Properties/AssemblyInfo.cs +++ b/src/Maui/Prism.Maui/Properties/AssemblyInfo.cs @@ -7,6 +7,6 @@ [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Modularity")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Mvvm")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Navigation.Xaml")] -[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Regions.Xaml")] +[assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Navigation.Regions.Xaml")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Dialogs.Xaml")] [assembly: XmlnsDefinition("http://prismlibrary.com", "Prism.Xaml")] diff --git a/src/Prism.Core/Navigation/INavigationResult.cs b/src/Prism.Core/Navigation/INavigationResult.cs index aef44b44b3..defbfadd0e 100644 --- a/src/Prism.Core/Navigation/INavigationResult.cs +++ b/src/Prism.Core/Navigation/INavigationResult.cs @@ -1,5 +1,5 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Navigation; diff --git a/src/Prism.Core/Navigation/NavigationResult.cs b/src/Prism.Core/Navigation/NavigationResult.cs index ea0d3280c2..19318edfdc 100644 --- a/src/Prism.Core/Navigation/NavigationResult.cs +++ b/src/Prism.Core/Navigation/NavigationResult.cs @@ -1,5 +1,5 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Navigation; diff --git a/src/Prism.Core/Regions/IConfirmNavigationRequest.cs b/src/Prism.Core/Navigation/Regions/IConfirmNavigationRequest.cs similarity index 96% rename from src/Prism.Core/Regions/IConfirmNavigationRequest.cs rename to src/Prism.Core/Navigation/Regions/IConfirmNavigationRequest.cs index 5cf3c386e6..49083b1dd0 100644 --- a/src/Prism.Core/Regions/IConfirmNavigationRequest.cs +++ b/src/Prism.Core/Navigation/Regions/IConfirmNavigationRequest.cs @@ -1,6 +1,6 @@ using System; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides a way for objects involved in navigation to determine if a navigation request should continue. diff --git a/src/Prism.Core/Regions/IJournalAware.cs b/src/Prism.Core/Navigation/Regions/IJournalAware.cs similarity index 92% rename from src/Prism.Core/Regions/IJournalAware.cs rename to src/Prism.Core/Navigation/Regions/IJournalAware.cs index dc80eaa30b..446aa4fff7 100644 --- a/src/Prism.Core/Regions/IJournalAware.cs +++ b/src/Prism.Core/Navigation/Regions/IJournalAware.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides a way for objects involved in navigation to opt-out of being added to the IRegionNavigationJournal backstack. diff --git a/src/Prism.Core/Regions/INavigateAsync.cs b/src/Prism.Core/Navigation/Regions/INavigateAsync.cs similarity index 91% rename from src/Prism.Core/Regions/INavigateAsync.cs rename to src/Prism.Core/Navigation/Regions/INavigateAsync.cs index 70efdf8f3b..9fbea95ec9 100644 --- a/src/Prism.Core/Regions/INavigateAsync.cs +++ b/src/Prism.Core/Navigation/Regions/INavigateAsync.cs @@ -1,13 +1,13 @@ using System; using Prism.Navigation; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides methods to perform navigation. /// /// - /// Convenience overloads for the methods in this interface can be found as extension methods on the + /// Convenience overloads for the methods in this interface can be found as extension methods on the /// class. /// public interface INavigateAsync @@ -19,7 +19,7 @@ public interface INavigateAsync /// The callback executed when the navigation request is completed. /// The navigation parameters specific to the navigation request. /// - /// Convenience overloads for this method can be found as extension methods on the + /// Convenience overloads for this method can be found as extension methods on the /// class. /// void RequestNavigate(Uri target, Action navigationCallback, INavigationParameters navigationParameters); diff --git a/src/Prism.Core/Regions/IRegion.cs b/src/Prism.Core/Navigation/Regions/IRegion.cs similarity index 99% rename from src/Prism.Core/Regions/IRegion.cs rename to src/Prism.Core/Navigation/Regions/IRegion.cs index 205a743279..5ff4fe0fc3 100644 --- a/src/Prism.Core/Regions/IRegion.cs +++ b/src/Prism.Core/Navigation/Regions/IRegion.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines a model that can be used to compose views. diff --git a/src/Prism.Core/Regions/IRegionAdapter.cs b/src/Prism.Core/Navigation/Regions/IRegionAdapter.cs similarity index 94% rename from src/Prism.Core/Regions/IRegionAdapter.cs rename to src/Prism.Core/Navigation/Regions/IRegionAdapter.cs index b08c6f266d..455b186a20 100644 --- a/src/Prism.Core/Regions/IRegionAdapter.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionAdapter.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines an interfaces to adapt an object and bind it to a new . diff --git a/src/Prism.Core/Regions/IRegionAware.cs b/src/Prism.Core/Navigation/Regions/IRegionAware.cs similarity index 97% rename from src/Prism.Core/Regions/IRegionAware.cs rename to src/Prism.Core/Navigation/Regions/IRegionAware.cs index dc0a912210..ce6f51e2a9 100644 --- a/src/Prism.Core/Regions/IRegionAware.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionAware.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides a way for objects involved in navigation to be notified of navigation activities. diff --git a/src/Prism.Core/Regions/IRegionBehavior.cs b/src/Prism.Core/Navigation/Regions/IRegionBehavior.cs similarity index 92% rename from src/Prism.Core/Regions/IRegionBehavior.cs rename to src/Prism.Core/Navigation/Regions/IRegionBehavior.cs index b5113463c5..0aeb6b3853 100644 --- a/src/Prism.Core/Regions/IRegionBehavior.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionBehavior.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Interface for allowing extensible behavior on regions. diff --git a/src/Prism.Core/Regions/IRegionBehaviorCollection.cs b/src/Prism.Core/Navigation/Regions/IRegionBehaviorCollection.cs similarity index 89% rename from src/Prism.Core/Regions/IRegionBehaviorCollection.cs rename to src/Prism.Core/Navigation/Regions/IRegionBehaviorCollection.cs index 02aad070f8..7f7e82a5c1 100644 --- a/src/Prism.Core/Regions/IRegionBehaviorCollection.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionBehaviorCollection.cs @@ -1,6 +1,6 @@ using System.Collections.Generic; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines the interface for a collection of classes on a Region. @@ -9,16 +9,16 @@ public interface IRegionBehaviorCollection : IEnumerable - /// Adds a to the collection, using the specified key as an indexer. + /// Adds a to the collection, using the specified key as an indexer. /// /// - /// The key that specifies the type of that's added. + /// The key that specifies the type of that's added. /// /// The to add. void Add(string key, IRegionBehavior regionBehavior); /// - /// Checks if a with the specified key is already present. + /// Checks if a with the specified key is already present. /// /// The key to use to find a particular . /// diff --git a/src/Prism.Core/Regions/IRegionBehaviorFactory.cs b/src/Prism.Core/Navigation/Regions/IRegionBehaviorFactory.cs similarity index 97% rename from src/Prism.Core/Regions/IRegionBehaviorFactory.cs rename to src/Prism.Core/Navigation/Regions/IRegionBehaviorFactory.cs index 064d171fa4..2ce6ab0ecc 100644 --- a/src/Prism.Core/Regions/IRegionBehaviorFactory.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionBehaviorFactory.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Interface for RegionBehaviorFactories. This factory allows the registration of the default set of RegionBehaviors, that will diff --git a/src/Prism.Core/Regions/IRegionBehaviorFactoryExtensions.cs b/src/Prism.Core/Navigation/Regions/IRegionBehaviorFactoryExtensions.cs similarity index 97% rename from src/Prism.Core/Regions/IRegionBehaviorFactoryExtensions.cs rename to src/Prism.Core/Navigation/Regions/IRegionBehaviorFactoryExtensions.cs index d0eb120136..0659fe7502 100644 --- a/src/Prism.Core/Regions/IRegionBehaviorFactoryExtensions.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionBehaviorFactoryExtensions.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Extension methods for the IRegionBehaviorFactory. diff --git a/src/Prism.Core/Regions/IRegionCollection.cs b/src/Prism.Core/Navigation/Regions/IRegionCollection.cs similarity index 97% rename from src/Prism.Core/Regions/IRegionCollection.cs rename to src/Prism.Core/Navigation/Regions/IRegionCollection.cs index a762376d9f..628626cba7 100644 --- a/src/Prism.Core/Regions/IRegionCollection.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionCollection.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Collections.Specialized; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines a collection of uniquely identified by their Name. @@ -40,7 +40,7 @@ public interface IRegionCollection : IEnumerable, INotifyCollectionChan /// Adds a region to the with the name received as argument. /// /// The name to be given to the region. - /// The region to be added to the . + /// The region to be added to the . /// Thrown if is . /// Thrown if and 's name do not match and the is not . void Add(string regionName, IRegion region); diff --git a/src/Prism.Core/Regions/IRegionManager.cs b/src/Prism.Core/Navigation/Regions/IRegionManager.cs similarity index 99% rename from src/Prism.Core/Regions/IRegionManager.cs rename to src/Prism.Core/Navigation/Regions/IRegionManager.cs index 40f9287312..a977465570 100644 --- a/src/Prism.Core/Regions/IRegionManager.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionManager.cs @@ -2,7 +2,7 @@ using Prism.Ioc; using Prism.Navigation; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines an interface to manage a set of regions and to attach regions to objects (typically controls). diff --git a/src/Prism.Core/Regions/IRegionManagerExtensions.cs b/src/Prism.Core/Navigation/Regions/IRegionManagerExtensions.cs similarity index 99% rename from src/Prism.Core/Regions/IRegionManagerExtensions.cs rename to src/Prism.Core/Navigation/Regions/IRegionManagerExtensions.cs index 6f70b1e6f1..87aad75fdd 100644 --- a/src/Prism.Core/Regions/IRegionManagerExtensions.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionManagerExtensions.cs @@ -1,7 +1,7 @@ using System; using Prism.Navigation; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Common Extensions for the RegionManager diff --git a/src/Prism.Core/Regions/IRegionMemberLifetime.cs b/src/Prism.Core/Navigation/Regions/IRegionMemberLifetime.cs similarity index 93% rename from src/Prism.Core/Regions/IRegionMemberLifetime.cs rename to src/Prism.Core/Navigation/Regions/IRegionMemberLifetime.cs index b6d8b43149..bc2ab7c760 100644 --- a/src/Prism.Core/Regions/IRegionMemberLifetime.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionMemberLifetime.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// When implemented, allows an instance placed in a diff --git a/src/Prism.Core/Regions/IRegionNavigationContentLoader.cs b/src/Prism.Core/Navigation/Regions/IRegionNavigationContentLoader.cs similarity index 96% rename from src/Prism.Core/Regions/IRegionNavigationContentLoader.cs rename to src/Prism.Core/Navigation/Regions/IRegionNavigationContentLoader.cs index 6487586c91..a2553e591e 100644 --- a/src/Prism.Core/Regions/IRegionNavigationContentLoader.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionNavigationContentLoader.cs @@ -1,6 +1,6 @@ using System; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Identifies the view in a region that is the target of a navigation request. diff --git a/src/Prism.Core/Regions/IRegionNavigationJournal.cs b/src/Prism.Core/Navigation/Regions/IRegionNavigationJournal.cs similarity index 98% rename from src/Prism.Core/Regions/IRegionNavigationJournal.cs rename to src/Prism.Core/Navigation/Regions/IRegionNavigationJournal.cs index 32590e0302..f7709e74ab 100644 --- a/src/Prism.Core/Regions/IRegionNavigationJournal.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionNavigationJournal.cs @@ -1,4 +1,4 @@ -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides journaling of current, back, and forward navigation within regions. diff --git a/src/Prism.Core/Regions/IRegionNavigationJournalEntry.cs b/src/Prism.Core/Navigation/Regions/IRegionNavigationJournalEntry.cs similarity index 93% rename from src/Prism.Core/Regions/IRegionNavigationJournalEntry.cs rename to src/Prism.Core/Navigation/Regions/IRegionNavigationJournalEntry.cs index ae04db3d8a..7226e23482 100644 --- a/src/Prism.Core/Regions/IRegionNavigationJournalEntry.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionNavigationJournalEntry.cs @@ -1,7 +1,7 @@ using System; using Prism.Navigation; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// An entry in an IRegionNavigationJournal representing the URI navigated to. diff --git a/src/Prism.Core/Regions/IRegionNavigationRegistry.cs b/src/Prism.Core/Navigation/Regions/IRegionNavigationRegistry.cs similarity index 70% rename from src/Prism.Core/Regions/IRegionNavigationRegistry.cs rename to src/Prism.Core/Navigation/Regions/IRegionNavigationRegistry.cs index c3470312d2..e82a602cb9 100644 --- a/src/Prism.Core/Regions/IRegionNavigationRegistry.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionNavigationRegistry.cs @@ -1,5 +1,5 @@ using Prism.Mvvm; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; public interface IRegionNavigationRegistry : IViewRegistry { } diff --git a/src/Prism.Core/Regions/IRegionNavigationService.cs b/src/Prism.Core/Navigation/Regions/IRegionNavigationService.cs similarity index 96% rename from src/Prism.Core/Regions/IRegionNavigationService.cs rename to src/Prism.Core/Navigation/Regions/IRegionNavigationService.cs index f402b2207b..dff55aa253 100644 --- a/src/Prism.Core/Regions/IRegionNavigationService.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionNavigationService.cs @@ -1,6 +1,6 @@ using System; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides navigation for regions. diff --git a/src/Prism.Core/Regions/IRegionViewRegistry.cs b/src/Prism.Core/Navigation/Regions/IRegionViewRegistry.cs similarity index 97% rename from src/Prism.Core/Regions/IRegionViewRegistry.cs rename to src/Prism.Core/Navigation/Regions/IRegionViewRegistry.cs index 27dca489c1..9f0af013a1 100644 --- a/src/Prism.Core/Regions/IRegionViewRegistry.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionViewRegistry.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Prism.Ioc; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines the interface for the registry of region's content. @@ -44,7 +44,7 @@ public interface IRegionViewRegistry void RegisterViewWithRegion(string regionName, Type viewType); /// - /// Registers a delegate that can be used to retrieve the content associated with a region name. + /// Registers a delegate that can be used to retrieve the content associated with a region name. /// /// Region name to which the will be registered. /// Delegate used to retrieve the content associated with the . diff --git a/src/Prism.Core/Regions/IViewsCollection.cs b/src/Prism.Core/Navigation/Regions/IViewsCollection.cs similarity index 94% rename from src/Prism.Core/Regions/IViewsCollection.cs rename to src/Prism.Core/Navigation/Regions/IViewsCollection.cs index dea55f3b4c..d7974de538 100644 --- a/src/Prism.Core/Regions/IViewsCollection.cs +++ b/src/Prism.Core/Navigation/Regions/IViewsCollection.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; using System.Collections.Specialized; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines a view of a collection. diff --git a/src/Prism.Core/Regions/NavigationAsyncExtensions.cs b/src/Prism.Core/Navigation/Regions/NavigationAsyncExtensions.cs similarity index 98% rename from src/Prism.Core/Regions/NavigationAsyncExtensions.cs rename to src/Prism.Core/Navigation/Regions/NavigationAsyncExtensions.cs index 4a3bac62ef..07f380c365 100644 --- a/src/Prism.Core/Regions/NavigationAsyncExtensions.cs +++ b/src/Prism.Core/Navigation/Regions/NavigationAsyncExtensions.cs @@ -1,7 +1,7 @@ using System; using Prism.Navigation; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides additional methods to the interface. @@ -15,7 +15,7 @@ public static class NavigationAsyncExtensions /// The navigation target /// The callback executed when the navigation request is completed. /// - /// Convenience overloads for this method can be found as extension methods on the + /// Convenience overloads for this method can be found as extension methods on the /// class. /// public static void RequestNavigate(this INavigateAsync navigation, Uri target, Action navigationCallback) => diff --git a/src/Prism.Core/Regions/NavigationContext.cs b/src/Prism.Core/Navigation/Regions/NavigationContext.cs similarity index 95% rename from src/Prism.Core/Regions/NavigationContext.cs rename to src/Prism.Core/Navigation/Regions/NavigationContext.cs index 7cac314efc..b39d15a016 100644 --- a/src/Prism.Core/Regions/NavigationContext.cs +++ b/src/Prism.Core/Navigation/Regions/NavigationContext.cs @@ -3,7 +3,7 @@ using Prism.Common; using Prism.Navigation; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Encapsulates information about a navigation request. @@ -11,7 +11,7 @@ namespace Prism.Regions public class NavigationContext { /// - /// Initializes a new instance of the class for a region name and a + /// Initializes a new instance of the class for a region name and a /// . /// /// The navigation service. @@ -21,7 +21,7 @@ public NavigationContext(IRegionNavigationService navigationService, Uri uri) : } /// - /// Initializes a new instance of the class for a region name and a + /// Initializes a new instance of the class for a region name and a /// . /// /// The navigation service. diff --git a/src/Prism.Core/Regions/NavigationContextExtensions.cs b/src/Prism.Core/Navigation/Regions/NavigationContextExtensions.cs similarity index 95% rename from src/Prism.Core/Regions/NavigationContextExtensions.cs rename to src/Prism.Core/Navigation/Regions/NavigationContextExtensions.cs index 2d08307ce4..f4bc99060a 100644 --- a/src/Prism.Core/Regions/NavigationContextExtensions.cs +++ b/src/Prism.Core/Navigation/Regions/NavigationContextExtensions.cs @@ -1,6 +1,6 @@ using Prism.Common; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides extensions for the Navigation Context diff --git a/src/Prism.Core/Regions/RegionBehavior.cs b/src/Prism.Core/Navigation/Regions/RegionBehavior.cs similarity index 97% rename from src/Prism.Core/Regions/RegionBehavior.cs rename to src/Prism.Core/Navigation/Regions/RegionBehavior.cs index 85a184b14d..8020d77ab3 100644 --- a/src/Prism.Core/Regions/RegionBehavior.cs +++ b/src/Prism.Core/Navigation/Regions/RegionBehavior.cs @@ -1,7 +1,7 @@ using System; using Prism.Properties; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides a base class for region's behaviors. diff --git a/src/Prism.Core/Regions/RegionBehaviorCollection.cs b/src/Prism.Core/Navigation/Regions/RegionBehaviorCollection.cs similarity index 99% rename from src/Prism.Core/Regions/RegionBehaviorCollection.cs rename to src/Prism.Core/Navigation/Regions/RegionBehaviorCollection.cs index 0b5c089bc0..eb7889b667 100644 --- a/src/Prism.Core/Regions/RegionBehaviorCollection.cs +++ b/src/Prism.Core/Navigation/Regions/RegionBehaviorCollection.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// A collection of instances, that are stored and retrieved by Key. diff --git a/src/Prism.Core/Regions/RegionBehaviorFactory.cs b/src/Prism.Core/Navigation/Regions/RegionBehaviorFactory.cs similarity index 99% rename from src/Prism.Core/Regions/RegionBehaviorFactory.cs rename to src/Prism.Core/Navigation/Regions/RegionBehaviorFactory.cs index 8caaa17f95..e0766d93ca 100644 --- a/src/Prism.Core/Regions/RegionBehaviorFactory.cs +++ b/src/Prism.Core/Navigation/Regions/RegionBehaviorFactory.cs @@ -5,7 +5,7 @@ using Prism.Ioc; using Prism.Properties; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines a factory that allows the registration of the default set of , that will diff --git a/src/Prism.Core/Regions/RegionCreationException.cs b/src/Prism.Core/Navigation/Regions/RegionCreationException.cs similarity index 95% rename from src/Prism.Core/Regions/RegionCreationException.cs rename to src/Prism.Core/Navigation/Regions/RegionCreationException.cs index 5e7d62a9bc..6fd9cff532 100644 --- a/src/Prism.Core/Regions/RegionCreationException.cs +++ b/src/Prism.Core/Navigation/Regions/RegionCreationException.cs @@ -3,7 +3,7 @@ using System.Runtime.Serialization; using System.Text; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// An exception used when encountering an error in the creation of a Region diff --git a/src/Prism.Core/Regions/RegionException.cs b/src/Prism.Core/Navigation/Regions/RegionException.cs similarity index 94% rename from src/Prism.Core/Regions/RegionException.cs rename to src/Prism.Core/Navigation/Regions/RegionException.cs index e2103f093f..85a56cf976 100644 --- a/src/Prism.Core/Regions/RegionException.cs +++ b/src/Prism.Core/Navigation/Regions/RegionException.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.Serialization; -namespace Prism.Regions; +namespace Prism.Navigation.Regions; /// /// Provides a common base class for Region Exceptions diff --git a/src/Prism.Core/Regions/RegionMemberLifetimeAttribute.cs b/src/Prism.Core/Navigation/Regions/RegionMemberLifetimeAttribute.cs similarity index 96% rename from src/Prism.Core/Regions/RegionMemberLifetimeAttribute.cs rename to src/Prism.Core/Navigation/Regions/RegionMemberLifetimeAttribute.cs index fa8feabe48..7e2e6067e6 100644 --- a/src/Prism.Core/Regions/RegionMemberLifetimeAttribute.cs +++ b/src/Prism.Core/Navigation/Regions/RegionMemberLifetimeAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// When is applied to class provides data diff --git a/src/Prism.Core/Regions/RegionNavigationEventArgs.cs b/src/Prism.Core/Navigation/Regions/RegionNavigationEventArgs.cs similarity index 96% rename from src/Prism.Core/Regions/RegionNavigationEventArgs.cs rename to src/Prism.Core/Navigation/Regions/RegionNavigationEventArgs.cs index 34b57ff0f0..53b11a6ec9 100644 --- a/src/Prism.Core/Regions/RegionNavigationEventArgs.cs +++ b/src/Prism.Core/Navigation/Regions/RegionNavigationEventArgs.cs @@ -1,6 +1,6 @@ using System; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// EventArgs used with the Navigated event. diff --git a/src/Prism.Core/Regions/RegionNavigationFailedEventArgs.cs b/src/Prism.Core/Navigation/Regions/RegionNavigationFailedEventArgs.cs similarity index 98% rename from src/Prism.Core/Regions/RegionNavigationFailedEventArgs.cs rename to src/Prism.Core/Navigation/Regions/RegionNavigationFailedEventArgs.cs index 22117cf9ee..72f5c7188f 100644 --- a/src/Prism.Core/Regions/RegionNavigationFailedEventArgs.cs +++ b/src/Prism.Core/Navigation/Regions/RegionNavigationFailedEventArgs.cs @@ -1,6 +1,6 @@ using System; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// EventArgs used with the NavigationFailed event. diff --git a/src/Prism.Core/Regions/RegionNavigationJournal.cs b/src/Prism.Core/Navigation/Regions/RegionNavigationJournal.cs similarity index 98% rename from src/Prism.Core/Regions/RegionNavigationJournal.cs rename to src/Prism.Core/Navigation/Regions/RegionNavigationJournal.cs index bce7af269a..1ec8654fa3 100644 --- a/src/Prism.Core/Regions/RegionNavigationJournal.cs +++ b/src/Prism.Core/Navigation/Regions/RegionNavigationJournal.cs @@ -1,10 +1,10 @@ using System; using System.Collections.Generic; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// - /// Provides journaling of current, back, and forward navigation within regions. + /// Provides journaling of current, back, and forward navigation within regions. /// public class RegionNavigationJournal : IRegionNavigationJournal { diff --git a/src/Prism.Core/Regions/RegionNavigationJournalEntry.cs b/src/Prism.Core/Navigation/Regions/RegionNavigationJournalEntry.cs similarity index 96% rename from src/Prism.Core/Regions/RegionNavigationJournalEntry.cs rename to src/Prism.Core/Navigation/Regions/RegionNavigationJournalEntry.cs index 2c5427cd90..d9b7ec6dc5 100644 --- a/src/Prism.Core/Regions/RegionNavigationJournalEntry.cs +++ b/src/Prism.Core/Navigation/Regions/RegionNavigationJournalEntry.cs @@ -2,7 +2,7 @@ using System.Globalization; using Prism.Navigation; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// An entry in an IRegionNavigationJournal representing the URI navigated to. diff --git a/src/Prism.Core/Regions/RegionViewRegistryExtensions.cs b/src/Prism.Core/Navigation/Regions/RegionViewRegistryExtensions.cs similarity index 95% rename from src/Prism.Core/Regions/RegionViewRegistryExtensions.cs rename to src/Prism.Core/Navigation/Regions/RegionViewRegistryExtensions.cs index a4e3188d43..ec120af447 100644 --- a/src/Prism.Core/Regions/RegionViewRegistryExtensions.cs +++ b/src/Prism.Core/Navigation/Regions/RegionViewRegistryExtensions.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Prism.Ioc; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides extensions for the . @@ -10,7 +10,7 @@ namespace Prism.Regions public static class RegionViewRegistryExtensions { /// - /// Registers a delegate that can be used to retrieve the content associated with a region name. + /// Registers a delegate that can be used to retrieve the content associated with a region name. /// /// The instance. /// Region name to which the will be registered. diff --git a/src/Prism.Core/Regions/SyncActiveStateAttribute.cs b/src/Prism.Core/Navigation/Regions/SyncActiveStateAttribute.cs similarity index 88% rename from src/Prism.Core/Regions/SyncActiveStateAttribute.cs rename to src/Prism.Core/Navigation/Regions/SyncActiveStateAttribute.cs index 8b0d844159..0c8be40824 100644 --- a/src/Prism.Core/Regions/SyncActiveStateAttribute.cs +++ b/src/Prism.Core/Navigation/Regions/SyncActiveStateAttribute.cs @@ -1,6 +1,6 @@ using System; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines that a view is synchronized with its parent view's Active state. diff --git a/src/Prism.Core/Regions/UpdateRegionsException.cs b/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs similarity index 95% rename from src/Prism.Core/Regions/UpdateRegionsException.cs rename to src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs index 23ebe578e1..dcbb060669 100644 --- a/src/Prism.Core/Regions/UpdateRegionsException.cs +++ b/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.Serialization; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Represents errors that occurred during the regions' update. @@ -26,11 +26,11 @@ public UpdateRegionsException(string message) } /// - /// Initializes a new instance of the class with a specified error message and a reference - /// to the inner exception that is the cause of this exception. + /// Initializes a new instance of the class with a specified error message and a reference + /// to the inner exception that is the cause of this exception. /// /// The error message that explains the reason for the exception. - /// The exception that is the cause of the current exception, or a null reference + /// The exception that is the cause of the current exception, or a null reference /// (Nothing in Visual Basic) if no inner exception is specified. public UpdateRegionsException(string message, Exception inner) : base(message, inner) diff --git a/src/Prism.Core/Regions/ViewRegisteredEventArgs.cs b/src/Prism.Core/Navigation/Regions/ViewRegisteredEventArgs.cs similarity index 96% rename from src/Prism.Core/Regions/ViewRegisteredEventArgs.cs rename to src/Prism.Core/Navigation/Regions/ViewRegisteredEventArgs.cs index 1b25eb5cd4..0fe3bd80de 100644 --- a/src/Prism.Core/Regions/ViewRegisteredEventArgs.cs +++ b/src/Prism.Core/Navigation/Regions/ViewRegisteredEventArgs.cs @@ -1,7 +1,7 @@ using System; using Prism.Ioc; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Argument class used by the event when a new content is registered. diff --git a/src/Prism.Core/Regions/ViewRegistrationException.cs b/src/Prism.Core/Navigation/Regions/ViewRegistrationException.cs similarity index 96% rename from src/Prism.Core/Regions/ViewRegistrationException.cs rename to src/Prism.Core/Navigation/Regions/ViewRegistrationException.cs index b242cd90d4..d5263342a8 100644 --- a/src/Prism.Core/Regions/ViewRegistrationException.cs +++ b/src/Prism.Core/Navigation/Regions/ViewRegistrationException.cs @@ -1,10 +1,10 @@ using System; using System.Runtime.Serialization; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// - /// Exception that's thrown when something goes wrong while Registering a View with a region name in the class. + /// Exception that's thrown when something goes wrong while Registering a View with a region name in the class. /// [Serializable] public partial class ViewRegistrationException : Exception @@ -44,7 +44,7 @@ public ViewRegistrationException(string message, Exception inner) : base(message /// /// Initializes a new instance of the class with serialized data. /// - /// The that holds the serialized + /// The that holds the serialized /// object data about the exception being thrown. /// The that contains contextual information about the source or destination. protected ViewRegistrationException(SerializationInfo info, StreamingContext context) diff --git a/src/Prism.Core/Regions/ViewSortHintAttribute.cs b/src/Prism.Core/Navigation/Regions/ViewSortHintAttribute.cs similarity index 95% rename from src/Prism.Core/Regions/ViewSortHintAttribute.cs rename to src/Prism.Core/Navigation/Regions/ViewSortHintAttribute.cs index d619af282f..6559a0eedf 100644 --- a/src/Prism.Core/Regions/ViewSortHintAttribute.cs +++ b/src/Prism.Core/Navigation/Regions/ViewSortHintAttribute.cs @@ -1,7 +1,7 @@ using System; using System.Net; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides a hint from a view to a region on how to sort the view. diff --git a/src/Prism.Core/build/Package.targets b/src/Prism.Core/build/Package.targets index 5fd315f148..84a626eca2 100644 --- a/src/Prism.Core/build/Package.targets +++ b/src/Prism.Core/build/Package.targets @@ -9,6 +9,6 @@ - + diff --git a/src/Uno/Prism.Uno/PrismApplicationBase.cs b/src/Uno/Prism.Uno/PrismApplicationBase.cs index 7fe5cbac06..4160a15611 100644 --- a/src/Uno/Prism.Uno/PrismApplicationBase.cs +++ b/src/Uno/Prism.Uno/PrismApplicationBase.cs @@ -5,8 +5,7 @@ using Prism.Ioc; using Prism.Modularity; using Prism.Mvvm; -using Prism.Regions; -using Uno.Extensions.Hosting; +using Prism.Navigation.Regions; using Application = Microsoft.UI.Xaml.Application; #nullable enable @@ -132,8 +131,8 @@ protected virtual void Initialize(IApplicationBuilder builder) void FinalizeInitialization() { - Regions.RegionManager.SetRegionManager(shell, _containerExtension.Resolve()); - Regions.RegionManager.UpdateRegions(); + Navigation.Regions.RegionManager.SetRegionManager(shell, _containerExtension.Resolve()); + Navigation.Regions.RegionManager.UpdateRegions(); _host = builder.Build(); InitializeModules(); OnInitialized(); diff --git a/src/Wpf/Prism.DryIoc.Wpf/PrismApplication.cs b/src/Wpf/Prism.DryIoc.Wpf/PrismApplication.cs index 56c41fe3f6..42d2d911a5 100644 --- a/src/Wpf/Prism.DryIoc.Wpf/PrismApplication.cs +++ b/src/Wpf/Prism.DryIoc.Wpf/PrismApplication.cs @@ -1,7 +1,7 @@ using System; using DryIoc; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using ExceptionExtensions = System.ExceptionExtensions; namespace Prism.DryIoc @@ -27,7 +27,7 @@ protected override IContainerExtension CreateContainerExtension() } /// - /// Registers the s of the Exceptions that are not considered + /// Registers the s of the Exceptions that are not considered /// root exceptions by the . /// protected override void RegisterFrameworkExceptionTypes() diff --git a/src/Wpf/Prism.Wpf/Regions/AllActiveRegion.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/AllActiveRegion.cs similarity index 96% rename from src/Wpf/Prism.Wpf/Regions/AllActiveRegion.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/AllActiveRegion.cs index 6216a7afe3..92441b20e2 100644 --- a/src/Wpf/Prism.Wpf/Regions/AllActiveRegion.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/AllActiveRegion.cs @@ -1,7 +1,7 @@ using System; using Prism.Properties; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Region that keeps all the views in it as active. Deactivation of views is not allowed. diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/AutoPopulateRegionBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/AutoPopulateRegionBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs index 3bee518451..a8accd4eaa 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/AutoPopulateRegionBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/AutoPopulateRegionBehavior.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using Prism.Ioc; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Populates the target region with the views registered to it in the . diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/BindRegionContextToDependencyObjectBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/BindRegionContextToDependencyObjectBehavior.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/BindRegionContextToDependencyObjectBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/BindRegionContextToDependencyObjectBehavior.cs index 79abbd3d6f..a90ddde8fb 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/BindRegionContextToDependencyObjectBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/BindRegionContextToDependencyObjectBehavior.cs @@ -1,5 +1,3 @@ - - using Prism.Common; using System.Collections; using System.Collections.Specialized; @@ -11,7 +9,7 @@ using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Defines a behavior that forwards the diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/ClearChildViewsRegionBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/ClearChildViewsRegionBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs index 286e014bcc..040a4701d2 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/ClearChildViewsRegionBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/ClearChildViewsRegionBehavior.cs @@ -1,5 +1,3 @@ - - using System; #if HAS_WINUI @@ -8,7 +6,7 @@ using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Behavior that removes the RegionManager attached property of all the views in a region once the RegionManager property of a region becomes null. diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/DelayedRegionCreationBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/DelayedRegionCreationBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs index a703c60d87..994fbc4d0e 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/DelayedRegionCreationBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/DelayedRegionCreationBehavior.cs @@ -10,7 +10,7 @@ using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Behavior that creates a new , when the control that will host the (see ) diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/DestructibleRegionBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs similarity index 95% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/DestructibleRegionBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs index eedfeee515..47252c3610 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/DestructibleRegionBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/DestructibleRegionBehavior.cs @@ -1,9 +1,8 @@ using System; using System.Collections.Specialized; using Prism.Common; -using Prism.Navigation; -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Calls on Views and ViewModels diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/IHostAwareRegionBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs similarity index 94% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/IHostAwareRegionBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs index 20f2b5162f..ee303ac768 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/IHostAwareRegionBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/IHostAwareRegionBehavior.cs @@ -1,12 +1,10 @@ - - #if HAS_WINUI using Microsoft.UI.Xaml; #else using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Defines a that not allows extensible behaviors on regions which also interact diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionActiveAwareBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs similarity index 95% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/RegionActiveAwareBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs index 0783187bb7..dc9866dab9 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionActiveAwareBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionActiveAwareBehavior.cs @@ -1,9 +1,6 @@ - - using System; using System.Collections.Specialized; using System.Linq; -using System.Reflection; using Prism.Common; #if HAS_WINUI @@ -12,7 +9,7 @@ using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Behavior that monitors a object and @@ -22,7 +19,7 @@ namespace Prism.Regions.Behaviors /// /// /// This class can also sync the active state for any scoped regions directly on the view based on the . - /// If you use the method with the createRegionManagerScope option, the scoped manager will be attached to the view. + /// If you use the method with the createRegionManagerScope option, the scoped manager will be attached to the view. /// public class RegionActiveAwareBehavior : IRegionBehavior { diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionManagerRegistrationBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/RegionManagerRegistrationBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs index 68521b4752..0f42de884a 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionManagerRegistrationBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionManagerRegistrationBehavior.cs @@ -1,9 +1,6 @@ - - using System; using System.ComponentModel; using Prism.Properties; -using System.Globalization; #if HAS_WINUI using Microsoft.UI.Xaml; @@ -12,7 +9,7 @@ using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Subscribes to a static event from the in order to register the target diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionMemberLifetimeBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/RegionMemberLifetimeBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs index 5fead2a529..3047a22e3b 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/RegionMemberLifetimeBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/RegionMemberLifetimeBehavior.cs @@ -1,5 +1,3 @@ - - using System; using System.Collections.Generic; using System.Linq; @@ -12,7 +10,7 @@ using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// The RegionMemberLifetimeBehavior determines if items should be removed from the diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/SelectorItemsSourceSyncBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/SelectorItemsSourceSyncBehavior.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/SelectorItemsSourceSyncBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/SelectorItemsSourceSyncBehavior.cs index 72ea6e59b9..9654e5bf68 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/SelectorItemsSourceSyncBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/SelectorItemsSourceSyncBehavior.cs @@ -1,5 +1,3 @@ - - using System; using System.Collections.Generic; using System.Collections.Specialized; @@ -17,7 +15,7 @@ using System.Windows.Data; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Defines the attached behavior that keeps the items of the host control in synchronization with the . diff --git a/src/Wpf/Prism.Wpf/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs index da70aa8bcb..e545d5cfa3 100644 --- a/src/Wpf/Prism.Wpf/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Behaviors/SyncRegionContextWithHostBehavior.cs @@ -1,5 +1,3 @@ - - using System; using Prism.Properties; using Prism.Common; @@ -10,7 +8,7 @@ using System.Windows; #endif -namespace Prism.Regions.Behaviors +namespace Prism.Navigation.Regions.Behaviors { /// /// Behavior that synchronizes the property of a with diff --git a/src/Wpf/Prism.Wpf/Regions/ContentControlRegionAdapter.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/ContentControlRegionAdapter.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/ContentControlRegionAdapter.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/ContentControlRegionAdapter.cs index 4be4e8166f..02d928ad6e 100644 --- a/src/Wpf/Prism.Wpf/Regions/ContentControlRegionAdapter.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/ContentControlRegionAdapter.cs @@ -1,5 +1,3 @@ - - using Prism.Properties; using System; using System.Collections.Specialized; @@ -14,7 +12,7 @@ using System.Windows.Data; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Adapter that creates a new and monitors its diff --git a/src/Wpf/Prism.Wpf/Regions/DefaultRegionManagerAccessor.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/DefaultRegionManagerAccessor.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/DefaultRegionManagerAccessor.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/DefaultRegionManagerAccessor.cs index 79fa1fae0f..cf08bff621 100644 --- a/src/Wpf/Prism.Wpf/Regions/DefaultRegionManagerAccessor.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/DefaultRegionManagerAccessor.cs @@ -6,7 +6,7 @@ using System.Windows; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { internal class DefaultRegionManagerAccessor : IRegionManagerAccessor { diff --git a/src/Wpf/Prism.Wpf/Regions/INavigationAware.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/INavigationAware.cs similarity index 90% rename from src/Wpf/Prism.Wpf/Regions/INavigationAware.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/INavigationAware.cs index 78046d6329..d43cc12808 100644 --- a/src/Wpf/Prism.Wpf/Regions/INavigationAware.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/INavigationAware.cs @@ -1,6 +1,6 @@ #if !HAS_UNO_WINUI && !HAS_WINUI -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides a way for objects involved in navigation to be notified of navigation activities. diff --git a/src/Wpf/Prism.Wpf/Regions/IRegionManagerAccessor.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/IRegionManagerAccessor.cs similarity index 97% rename from src/Wpf/Prism.Wpf/Regions/IRegionManagerAccessor.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/IRegionManagerAccessor.cs index 3de10e4139..185e30bed2 100644 --- a/src/Wpf/Prism.Wpf/Regions/IRegionManagerAccessor.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/IRegionManagerAccessor.cs @@ -6,7 +6,7 @@ using System.Windows; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides an abstraction on top of the RegionManager static members. diff --git a/src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/ItemMetadata.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/ItemMetadata.cs index e204066b71..721149db72 100644 --- a/src/Wpf/Prism.Wpf/Regions/ItemMetadata.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/ItemMetadata.cs @@ -6,7 +6,7 @@ using System.Windows; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines a class that wraps an item and adds metadata for it. diff --git a/src/Wpf/Prism.Wpf/Regions/ItemsControlRegionAdapter.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/ItemsControlRegionAdapter.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/ItemsControlRegionAdapter.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/ItemsControlRegionAdapter.cs index 5b10db0092..b7c08a32d8 100644 --- a/src/Wpf/Prism.Wpf/Regions/ItemsControlRegionAdapter.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/ItemsControlRegionAdapter.cs @@ -1,5 +1,3 @@ - - using Prism.Properties; using System; @@ -13,7 +11,7 @@ using System.Windows.Data; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Adapter that creates a new and binds all diff --git a/src/Wpf/Prism.Wpf/Regions/Region.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/Region.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/Region.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/Region.cs index d033c219b0..fea6bd0e6a 100644 --- a/src/Wpf/Prism.Wpf/Regions/Region.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/Region.cs @@ -1,12 +1,10 @@ using System; using System.Collections.ObjectModel; -using System.ComponentModel; using System.Diagnostics.CodeAnalysis; using System.Globalization; using System.Linq; using Prism.Properties; using Prism.Ioc; -using Prism.Navigation; #if HAS_WINUI using Microsoft.UI.Xaml; @@ -18,7 +16,7 @@ using System.Windows.Data; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Implementation of that allows multiple active views. diff --git a/src/Wpf/Prism.Wpf/Regions/RegionAdapterBase.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionAdapterBase.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/RegionAdapterBase.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/RegionAdapterBase.cs index 38b484837c..588c6755dc 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionAdapterBase.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionAdapterBase.cs @@ -1,7 +1,5 @@ - - using Prism.Properties; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions.Behaviors; using System; using System.Globalization; @@ -12,7 +10,7 @@ using System.Windows; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Base class to facilitate the creation of implementations. diff --git a/src/Wpf/Prism.Wpf/Regions/RegionAdapterMappings.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionAdapterMappings.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/RegionAdapterMappings.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/RegionAdapterMappings.cs index 42c3a9f7e7..d42f48fb29 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionAdapterMappings.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionAdapterMappings.cs @@ -4,7 +4,7 @@ using Prism.Ioc; using Prism.Properties; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// This class maps with . diff --git a/src/Wpf/Prism.Wpf/Regions/RegionContext.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionContext.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/RegionContext.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/RegionContext.cs index 1154d83a08..48d61b405e 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionContext.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionContext.cs @@ -1,5 +1,3 @@ - - using Prism.Common; using System; @@ -9,7 +7,7 @@ using System.Windows; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Class that holds methods to Set and Get the RegionContext from a DependencyObject. diff --git a/src/Wpf/Prism.Wpf/Regions/RegionManager.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionManager.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/RegionManager.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/RegionManager.cs index 4345223f0c..3b2e7b7b94 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionManager.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionManager.cs @@ -11,9 +11,8 @@ using Prism.Events; using Prism.Ioc; using Prism.Properties; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions.Behaviors; using Prism.Ioc.Internals; -using Prism.Navigation; #if HAS_WINUI using Microsoft.UI.Xaml; @@ -22,7 +21,7 @@ #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// This class is responsible for maintaining a collection of regions and attaching regions to controls. diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationContentLoader.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionNavigationContentLoader.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/RegionNavigationContentLoader.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/RegionNavigationContentLoader.cs index bad6a6763f..e01de9f7ba 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionNavigationContentLoader.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionNavigationContentLoader.cs @@ -14,7 +14,7 @@ #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Implementation of that relies on a diff --git a/src/Wpf/Prism.Wpf/Regions/RegionNavigationService.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionNavigationService.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/RegionNavigationService.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/RegionNavigationService.cs index da5b8b11cf..069cd710eb 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionNavigationService.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionNavigationService.cs @@ -5,7 +5,6 @@ using Prism.Common; using Prism.Properties; using Prism.Ioc; -using Prism.Navigation; #if HAS_WINUI using Microsoft.UI.Xaml; @@ -13,7 +12,7 @@ using System.Windows; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Provides navigation for regions. diff --git a/src/Wpf/Prism.Wpf/Regions/RegionViewRegistry.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionViewRegistry.cs similarity index 98% rename from src/Wpf/Prism.Wpf/Regions/RegionViewRegistry.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/RegionViewRegistry.cs index fd2c24d14b..0ead2d378a 100644 --- a/src/Wpf/Prism.Wpf/Regions/RegionViewRegistry.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/RegionViewRegistry.cs @@ -7,7 +7,7 @@ using Prism.Ioc; using Prism.Properties; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Defines a registry for the content of the regions used on View Discovery composition. @@ -64,7 +64,7 @@ public void RegisterViewWithRegion(string regionName, Type viewType) } /// - /// Registers a delegate that can be used to retrieve the content associated with a region name. + /// Registers a delegate that can be used to retrieve the content associated with a region name. /// /// Region name to which the will be registered. /// Delegate used to retrieve the content associated with the . @@ -86,7 +86,7 @@ public void RegisterViewWithRegion(string regionName, string targetName) => RegisterViewWithRegion(regionName, c => c.Resolve(targetName)); /// - /// Creates an instance of a registered view . + /// Creates an instance of a registered view . /// /// Type of the registered view. /// Instance of the registered view. diff --git a/src/Wpf/Prism.Wpf/Regions/SelectorRegionAdapter.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/SelectorRegionAdapter.cs similarity index 97% rename from src/Wpf/Prism.Wpf/Regions/SelectorRegionAdapter.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/SelectorRegionAdapter.cs index 3c545b3c15..9aa545cccf 100644 --- a/src/Wpf/Prism.Wpf/Regions/SelectorRegionAdapter.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/SelectorRegionAdapter.cs @@ -1,4 +1,4 @@ -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions.Behaviors; using System; #if HAS_WINUI @@ -7,7 +7,7 @@ using System.Windows.Controls.Primitives; #endif -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Adapter that creates a new and binds all diff --git a/src/Wpf/Prism.Wpf/Regions/SingleActiveRegion.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/SingleActiveRegion.cs similarity index 96% rename from src/Wpf/Prism.Wpf/Regions/SingleActiveRegion.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/SingleActiveRegion.cs index 3693103596..e6aebe228f 100644 --- a/src/Wpf/Prism.Wpf/Regions/SingleActiveRegion.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/SingleActiveRegion.cs @@ -1,6 +1,6 @@ using System.Linq; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Region that allows a maximum of one active view at a time. diff --git a/src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs b/src/Wpf/Prism.Wpf/Navigation/Regions/ViewsCollection.cs similarity index 99% rename from src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs rename to src/Wpf/Prism.Wpf/Navigation/Regions/ViewsCollection.cs index b7d06f5b1c..2d5640fd43 100644 --- a/src/Wpf/Prism.Wpf/Regions/ViewsCollection.cs +++ b/src/Wpf/Prism.Wpf/Navigation/Regions/ViewsCollection.cs @@ -5,7 +5,7 @@ using System.Collections.Specialized; using System.Linq; -namespace Prism.Regions +namespace Prism.Navigation.Regions { /// /// Implementation of that takes an of @@ -226,7 +226,7 @@ private void SourceCollectionChanged(object sender, NotifyCollectionChangedEvent } // If we're sorting we can't predict how - // the collection has changed on an add so we + // the collection has changed on an add so we // resort to a reset notification. if (this.sort != null) { diff --git a/src/Wpf/Prism.Wpf/PrismApplicationBase.cs b/src/Wpf/Prism.Wpf/PrismApplicationBase.cs index 408a71cee8..3ccd861f9e 100644 --- a/src/Wpf/Prism.Wpf/PrismApplicationBase.cs +++ b/src/Wpf/Prism.Wpf/PrismApplicationBase.cs @@ -3,7 +3,7 @@ using Prism.Common; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism { @@ -117,8 +117,8 @@ protected virtual void RegisterRequiredTypes(IContainerRegistry containerRegistr protected abstract void RegisterTypes(IContainerRegistry containerRegistry); /// - /// Configures the . - /// This will be the list of default behaviors that will be added to a region. + /// Configures the . + /// This will be the list of default behaviors that will be added to a region. /// protected virtual void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors) { @@ -137,7 +137,7 @@ protected virtual void ConfigureRegionAdapterMappings(RegionAdapterMappings regi } /// - /// Registers the s of the Exceptions that are not considered + /// Registers the s of the Exceptions that are not considered /// root exceptions by the . /// protected virtual void RegisterFrameworkExceptionTypes() diff --git a/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs b/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs index c1b4e05917..9a74a34ee9 100644 --- a/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs +++ b/src/Wpf/Prism.Wpf/PrismBootstrapperBase.cs @@ -3,7 +3,7 @@ using Prism.Common; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism { @@ -117,8 +117,8 @@ protected virtual void RegisterRequiredTypes(IContainerRegistry containerRegistr protected abstract void RegisterTypes(IContainerRegistry containerRegistry); /// - /// Configures the . - /// This will be the list of default behaviors that will be added to a region. + /// Configures the . + /// This will be the list of default behaviors that will be added to a region. /// protected virtual void ConfigureDefaultRegionBehaviors(IRegionBehaviorFactory regionBehaviors) { @@ -137,7 +137,7 @@ protected virtual void ConfigureRegionAdapterMappings(RegionAdapterMappings regi } /// - /// Registers the s of the Exceptions that are not considered + /// Registers the s of the Exceptions that are not considered /// root exceptions by the . /// protected virtual void RegisterFrameworkExceptionTypes() diff --git a/src/Wpf/Prism.Wpf/PrismInitializationExtensions.cs b/src/Wpf/Prism.Wpf/PrismInitializationExtensions.cs index 1356006ab8..284ec129e3 100644 --- a/src/Wpf/Prism.Wpf/PrismInitializationExtensions.cs +++ b/src/Wpf/Prism.Wpf/PrismInitializationExtensions.cs @@ -2,8 +2,8 @@ using Prism.Ioc; using Prism.Modularity; using Prism.Mvvm; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Dialogs; #if HAS_WINUI diff --git a/src/Wpf/Prism.Wpf/Properties/AssemblyInfo.cs b/src/Wpf/Prism.Wpf/Properties/AssemblyInfo.cs index a3bb05f446..935f20c32d 100644 --- a/src/Wpf/Prism.Wpf/Properties/AssemblyInfo.cs +++ b/src/Wpf/Prism.Wpf/Properties/AssemblyInfo.cs @@ -1,9 +1,5 @@ using System; -using System.Reflection; -using System.Resources; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using System.Windows; using System.Windows.Markup; [assembly: ComVisible(false)] @@ -11,14 +7,14 @@ [assembly: CLSCompliant(true)] // ----- Legacy ----- -[assembly: XmlnsDefinition("http://www.codeplex.com/prism", "Prism.Regions")] -[assembly: XmlnsDefinition("http://www.codeplex.com/prism", "Prism.Regions.Behaviors")] +[assembly: XmlnsDefinition("http://www.codeplex.com/prism", "Prism.Navigation.Regions")] +[assembly: XmlnsDefinition("http://www.codeplex.com/prism", "Prism.Navigation.Regions.Behaviors")] [assembly: XmlnsDefinition("http://www.codeplex.com/prism", "Prism.Mvvm")] [assembly: XmlnsDefinition("http://www.codeplex.com/prism", "Prism.Interactivity")] // ----- Legacy ----- -[assembly: XmlnsDefinition("http://prismlibrary.com/", "Prism.Regions")] -[assembly: XmlnsDefinition("http://prismlibrary.com/", "Prism.Regions.Behaviors")] +[assembly: XmlnsDefinition("http://prismlibrary.com/", "Prism.Navigation.Regions")] +[assembly: XmlnsDefinition("http://prismlibrary.com/", "Prism.Navigation.Regions.Behaviors")] [assembly: XmlnsDefinition("http://prismlibrary.com/", "Prism.Mvvm")] [assembly: XmlnsDefinition("http://prismlibrary.com/", "Prism.Interactivity")] [assembly: XmlnsDefinition("http://prismlibrary.com/", "Prism.Dialogs")] diff --git a/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs b/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs index 8bd37abb2a..d1c95eab64 100644 --- a/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs +++ b/tests/Forms/Prism.DI.Forms.Tests/Mocks/ViewModels/Issue2415PageViewModel.cs @@ -3,8 +3,8 @@ using System.Text; using Prism.Mvvm; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Navigation; using Xamarin.Forms; namespace Prism.DI.Forms.Tests.Mocks.ViewModels diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs index f325b0b6f3..6c258f4692 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockPresentationRegion.cs @@ -1,9 +1,9 @@ using System; using System.ComponentModel; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; +using Prism.Navigation.Regions.Navigation; using Xamarin.Forms; namespace Prism.Forms.Regions.Mocks diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs index f59d205eb3..4efa729aea 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegion.cs @@ -1,9 +1,9 @@ using System; using System.ComponentModel; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Behaviors; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; +using Prism.Navigation.Regions.Navigation; using Xamarin.Forms; namespace Prism.Forms.Regions.Mocks diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs index bb9cc19e50..740d7da8d0 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs @@ -1,7 +1,7 @@ using System.Collections.Generic; -using Prism.Regions; -using Prism.Regions.Adapters; +using Prism.Navigation.Regions; using Xamarin.Forms; +using RegionManager = Prism.Navigation.Regions.Xaml.RegionManager; namespace Prism.Forms.Regions.Mocks { @@ -17,7 +17,7 @@ public IRegion Initialize(object regionTarget, string regionName) var region = new MockPresentationRegion(); if (regionTarget is VisualElement element) - Prism.Regions.Xaml.RegionManager.GetObservableRegion(element).Value = region; + RegionManager.GetObservableRegion(element).Value = region; // Fire update regions again. This also happens if a region is created and added to the RegionManager if (Accessor != null) diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehavior.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehavior.cs index af79884abe..a0cb186a01 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehavior.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehavior.cs @@ -1,6 +1,6 @@ using System; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; namespace Prism.Forms.Regions.Mocks { diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs index 15b1c88a25..bfdaf6cfb0 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionBehaviorCollection.cs @@ -1,6 +1,6 @@ using System.Collections; using System.Collections.Generic; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Forms.Regions.Mocks { diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionManagerAccessor.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionManagerAccessor.cs index 1187aed735..1ae145229c 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionManagerAccessor.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionManagerAccessor.cs @@ -1,5 +1,6 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Forms.Regions.Mocks diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView1.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView1.cs index 8d7aa3e460..c4f7cef662 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView1.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView1.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Forms.Regions.Mocks diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView2.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView2.cs index da2a187a62..95d63ddc97 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView2.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView2.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Forms.Regions.Mocks diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView3.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView3.cs index d17980b655..1fbd472214 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView3.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockSortableView3.cs @@ -1,4 +1,4 @@ -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Forms.Regions.Mocks diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs index cb44f68569..d890e5fdc9 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockViewsCollection.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Forms.Regions.Mocks diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/AllActiveRegionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/AllActiveRegionFixture.cs index 33196554d7..6e22494545 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/AllActiveRegionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/AllActiveRegionFixture.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs index 9e47f358fc..eef3b6d59c 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Regions; -using Prism.Regions.Adapters; +using Prism.Navigation.Regions.Adapters; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs index a83b9808db..460251d50f 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs @@ -4,11 +4,12 @@ using Moq; using Prism.Ioc; using Prism.Ioc.Internals; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Navigation; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; -using Region = Prism.Regions.Region; +using Region = Prism.Navigation.Regions.Region; namespace Prism.Forms.Regions.Tests { diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs index ef24662954..fe4e8eb51d 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationAsyncExtensionsFixture.cs @@ -3,7 +3,7 @@ using System.Text; using Moq; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationContextFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationContextFixture.cs index 9553ea0273..75618cccb6 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationContextFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/NavigationContextFixture.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Text; using Moq; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Navigation; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs index 405d6b3efb..bfda2cbef8 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Regions; -using Prism.Regions.Adapters; +using Prism.Navigation.Regions.Adapters; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterMappingFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterMappingFixture.cs index 44407a6972..03b998bb4d 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterMappingFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterMappingFixture.cs @@ -4,7 +4,7 @@ using Moq; using Prism.Forms.Regions.Mocks; using Prism.Ioc; -using Prism.Regions.Adapters; +using Prism.Navigation.Regions.Adapters; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs index 4823622cae..a87ee94f1e 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorCollectionFixture.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs index d5ac28bb02..eea42ff125 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFactoryFixture.cs @@ -4,7 +4,7 @@ using Moq; using Prism.Forms.Regions.Mocks; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs index 1dad26097c..b4481d72a8 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionBehaviorFixture.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs index e67c294150..166e490a9e 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs @@ -1,16 +1,14 @@ using System; -using System.Collections.Generic; using System.Collections.Specialized; using System.Linq; -using System.Text; using Moq; using Prism.Ioc; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; -using Region = Prism.Regions.Region; +using Region = Prism.Navigation.Regions.Region; +using RegionManager = Prism.Navigation.Regions.Xaml.RegionManager; namespace Prism.Forms.Regions.Tests { @@ -174,7 +172,7 @@ public void AddViewPassesSameScopeByDefaultToView() region.Add(myView); - Assert.Same(regionManager, myView.GetValue(Prism.Regions.Xaml.RegionManager.RegionManagerProperty)); + Assert.Same(regionManager, myView.GetValue(RegionManager.RegionManagerProperty)); } [Fact] @@ -189,7 +187,7 @@ public void AddViewPassesSameScopeByDefaultToNamedView() region.Add(myView, "MyView"); - Assert.Same(regionManager, myView.GetValue(Prism.Regions.Xaml.RegionManager.RegionManagerProperty)); + Assert.Same(regionManager, myView.GetValue(RegionManager.RegionManagerProperty)); } [Fact] @@ -204,7 +202,7 @@ public void AddViewPassesDiferentScopeWhenAdding() region.Add(myView, "MyView", true); - Assert.NotSame(regionManager, myView.GetValue(Prism.Regions.Xaml.RegionManager.RegionManagerProperty)); + Assert.NotSame(regionManager, myView.GetValue(RegionManager.RegionManagerProperty)); } [Fact] @@ -542,7 +540,7 @@ public void WhenViewHasBeenRemovedAndRegionManagerPropertyCleared_ThenItCanBeAdd region.Remove(view); - view.ClearValue(Prism.Regions.Xaml.RegionManager.RegionManagerProperty); + view.ClearValue(RegionManager.RegionManagerProperty); Assert.Empty(region.Views); @@ -550,7 +548,7 @@ public void WhenViewHasBeenRemovedAndRegionManagerPropertyCleared_ThenItCanBeAdd Assert.Equal(view, region.Views.First()); - Assert.Same(newScopedRegion, view.GetValue(Prism.Regions.Xaml.RegionManager.RegionManagerProperty)); + Assert.Same(newScopedRegion, view.GetValue(RegionManager.RegionManagerProperty)); } [ViewSortHint("C")] diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs index 70095001c8..692f839673 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerFixture.cs @@ -1,15 +1,14 @@ using System; using System.Collections.Generic; using System.Collections.Specialized; -using System.Text; using System.Threading.Tasks; using Moq; using Prism.Forms.Regions.Mocks; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; -using Region = Prism.Regions.Region; +using Region = Prism.Navigation.Regions.Region; namespace Prism.Forms.Regions.Tests { @@ -129,7 +128,7 @@ public void UpdatingRegionsGetsCalledWhenAccessingRegionMembers() try { - Prism.Regions.Xaml.RegionManager.UpdatingRegions += listener.OnUpdatingRegions; + Navigation.Regions.Xaml.RegionManager.UpdatingRegions += listener.OnUpdatingRegions; var regionManager = new RegionManager(); regionManager.Regions.ContainsRegionWithName("TestRegion"); Assert.True(listener.OnUpdatingRegionsCalled); @@ -152,7 +151,7 @@ public void UpdatingRegionsGetsCalledWhenAccessingRegionMembers() } finally { - Prism.Regions.Xaml.RegionManager.UpdatingRegions -= listener.OnUpdatingRegions; + Navigation.Regions.Xaml.RegionManager.UpdatingRegions -= listener.OnUpdatingRegions; } } @@ -168,7 +167,7 @@ public void ShouldSetObservableRegionContextWhenRegionContextChanges() observableObject.PropertyChanged += (sender, args) => propertyChangedCalled = true; Assert.Null(observableObject.Value); - Prism.Regions.Xaml.RegionManager.SetRegionContext(view, "MyContext"); + Navigation.Regions.Xaml.RegionManager.SetRegionContext(view, "MyContext"); Assert.True(propertyChangedCalled); Assert.Equal("MyContext", observableObject.Value); } @@ -177,8 +176,8 @@ public void ShouldSetObservableRegionContextWhenRegionContextChanges() public async Task ShouldNotPreventSubscribersToStaticEventFromBeingGarbageCollected() { var subscriber = new MySubscriberClass(); - Prism.Regions.Xaml.RegionManager.UpdatingRegions += subscriber.OnUpdatingRegions; - Prism.Regions.Xaml.RegionManager.UpdateRegions(); + Navigation.Regions.Xaml.RegionManager.UpdatingRegions += subscriber.OnUpdatingRegions; + Navigation.Regions.Xaml.RegionManager.UpdateRegions(); Assert.True(subscriber.OnUpdatingRegionsCalled); var subscriberWeakReference = new WeakReference(subscriber); @@ -195,11 +194,11 @@ public void ExceptionMessageWhenCallingUpdateRegionsShouldBeClear() try { ExceptionExtensions.RegisterFrameworkExceptionType(typeof(FrameworkException)); - Prism.Regions.Xaml.RegionManager.UpdatingRegions += new EventHandler(RegionManager_UpdatingRegions); + Navigation.Regions.Xaml.RegionManager.UpdatingRegions += new EventHandler(RegionManager_UpdatingRegions); try { - Prism.Regions.Xaml.RegionManager.UpdateRegions(); + Navigation.Regions.Xaml.RegionManager.UpdateRegions(); //Assert.Fail(); } catch (Exception ex) @@ -209,7 +208,7 @@ public void ExceptionMessageWhenCallingUpdateRegionsShouldBeClear() } finally { - Prism.Regions.Xaml.RegionManager.UpdatingRegions -= new EventHandler(RegionManager_UpdatingRegions); + Navigation.Regions.Xaml.RegionManager.UpdatingRegions -= new EventHandler(RegionManager_UpdatingRegions); } } diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs index 60560df004..0f49b7cf18 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionManagerRequestNavigateFixture.cs @@ -3,8 +3,9 @@ using System.Text; using Moq; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Navigation; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs index a444489dd7..08d5a93b76 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationJournalFixture.cs @@ -3,8 +3,8 @@ using System.Text; using Moq; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Navigation; using Xunit; namespace Prism.Forms.Regions.Tests diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs index afdcaea510..476c5cf418 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs @@ -1,14 +1,15 @@ -using System; +using System; using System.Collections.Generic; using System.Linq; using Moq; using Prism.Ioc; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Navigation; +using Prism.Navigation.Regions.Navigation; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Navigation; using Xamarin.Forms; using Xunit; -using Region = Prism.Regions.Region; +using Region = Prism.Navigation.Regions.Region; namespace Prism.Forms.Regions.Tests { diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs index 29042e43b8..694a97f80b 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionViewRegistryFixture.cs @@ -5,7 +5,7 @@ using System.Threading.Tasks; using Moq; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/SingleActiveRegionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/SingleActiveRegionFixture.cs index e0fd70c57a..19ecd11021 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/SingleActiveRegionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/SingleActiveRegionFixture.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using System.Text; -using Prism.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs index 2db5a8a4c8..298aaf8520 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs @@ -5,10 +5,11 @@ using System.Linq; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Regions; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; -using Region = Prism.Regions.Region; +using Region = Prism.Navigation.Regions.Region; namespace Prism.Forms.Regions.Tests { diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockContentRegionPage.cs b/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockContentRegionPage.cs index 1252d0090d..5d4b495d78 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockContentRegionPage.cs +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockContentRegionPage.cs @@ -5,10 +5,10 @@ public class MockContentRegionPage : ContentPage public MockContentRegionPage() { ContentRegion = new ContentView(); - ContentRegion.SetValue(Prism.Regions.Xaml.RegionManager.RegionNameProperty, nameof(ContentRegion)); + ContentRegion.SetValue(Prism.Navigation.Regions.Xaml.RegionManager.RegionNameProperty, nameof(ContentRegion)); FrameRegion = new Frame(); - FrameRegion.SetValue(Prism.Regions.Xaml.RegionManager.RegionNameProperty, nameof(FrameRegion)); + FrameRegion.SetValue(Prism.Navigation.Regions.Xaml.RegionManager.RegionNameProperty, nameof(FrameRegion)); Content = new StackLayout { diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockPageWithRegionAndDefaultView.cs b/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockPageWithRegionAndDefaultView.cs index 52873c633f..5b97c59138 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockPageWithRegionAndDefaultView.cs +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Mocks/Views/MockPageWithRegionAndDefaultView.cs @@ -5,8 +5,8 @@ public class MockPageWithRegionAndDefaultView : ContentPage public MockPageWithRegionAndDefaultView() { var view = new ContentView(); - view.SetValue(Prism.Regions.Xaml.RegionManager.RegionNameProperty, "Demo"); - view.SetValue(Prism.Regions.Xaml.RegionManager.DefaultViewProperty, "MockRegionViewA"); + view.SetValue(Prism.Navigation.Regions.Xaml.RegionManager.RegionNameProperty, "Demo"); + view.SetValue(Prism.Navigation.Regions.Xaml.RegionManager.DefaultViewProperty, "MockRegionViewA"); Content = view; } } diff --git a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperFixture.cs b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperFixture.cs index 2cc21680b2..c034884796 100644 --- a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperFixture.cs +++ b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperFixture.cs @@ -2,7 +2,7 @@ using Prism.Container.Wpf.Mocks; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; using static Prism.Container.Wpf.Tests.ContainerHelper; diff --git a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperRunMethodFixture.cs b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperRunMethodFixture.cs index 60d4b7faa9..746de5da37 100644 --- a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperRunMethodFixture.cs +++ b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Bootstrapper/BootstrapperRunMethodFixture.cs @@ -3,7 +3,7 @@ using Prism.Events; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Container.Wpf.Tests.Bootstrapper diff --git a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Regions/RegionNavigationContentLoaderFixture.cs b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Regions/RegionNavigationContentLoaderFixture.cs index f749bc861c..c73f875ed8 100644 --- a/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Regions/RegionNavigationContentLoaderFixture.cs +++ b/tests/Wpf/Prism.Container.Wpf.Shared/Fixtures/Regions/RegionNavigationContentLoaderFixture.cs @@ -1,7 +1,7 @@ using System.Linq; using Prism.Ioc; using Prism.IocContainer.Wpf.Tests.Support.Mocks.Views; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; using static Prism.Container.Wpf.Tests.ContainerHelper; diff --git a/tests/Wpf/Prism.DryIoc.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs b/tests/Wpf/Prism.DryIoc.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs index 56a0e37a20..87b88c73e2 100644 --- a/tests/Wpf/Prism.DryIoc.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs +++ b/tests/Wpf/Prism.DryIoc.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs @@ -6,7 +6,7 @@ using Prism.Events; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Container.Wpf.Tests.Bootstrapper diff --git a/tests/Wpf/Prism.DryIoc.Wpf.Tests/Mocks/MockBootstrapper.cs b/tests/Wpf/Prism.DryIoc.Wpf.Tests/Mocks/MockBootstrapper.cs index d2defd122e..6ee2c090f0 100644 --- a/tests/Wpf/Prism.DryIoc.Wpf.Tests/Mocks/MockBootstrapper.cs +++ b/tests/Wpf/Prism.DryIoc.Wpf.Tests/Mocks/MockBootstrapper.cs @@ -6,7 +6,7 @@ using Prism.DryIoc; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Container.Wpf.Mocks { diff --git a/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs b/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs index b31f8cf7b2..dea47e0e35 100644 --- a/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs +++ b/tests/Wpf/Prism.IocContainer.Wpf.Tests.Support/Mocks/MockRegionManager.cs @@ -1,7 +1,7 @@ using System; using Prism.Ioc; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.IocContainer.Wpf.Tests.Support.Mocks { diff --git a/tests/Wpf/Prism.Unity.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs b/tests/Wpf/Prism.Unity.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs index b3529af97a..537318ea29 100644 --- a/tests/Wpf/Prism.Unity.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs +++ b/tests/Wpf/Prism.Unity.Wpf.Tests/Fixtures/BootstrapperRunMethodFixture.cs @@ -4,7 +4,7 @@ using Prism.Events; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Unity; using Unity; using Unity.Lifetime; diff --git a/tests/Wpf/Prism.Unity.Wpf.Tests/Mocks/MockBootstrapper.cs b/tests/Wpf/Prism.Unity.Wpf.Tests/Mocks/MockBootstrapper.cs index 6d9ce72ffb..001dc456bb 100644 --- a/tests/Wpf/Prism.Unity.Wpf.Tests/Mocks/MockBootstrapper.cs +++ b/tests/Wpf/Prism.Unity.Wpf.Tests/Mocks/MockBootstrapper.cs @@ -4,7 +4,7 @@ using System.Windows.Controls; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Unity; using Unity; diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockHostAwareRegionBehavior.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockHostAwareRegionBehavior.cs index df34c36d2f..dc25f392e1 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockHostAwareRegionBehavior.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockHostAwareRegionBehavior.cs @@ -1,8 +1,8 @@ using System.Windows; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs index ab63a17d33..3e45d34e2b 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockPresentationRegion.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs index c6aac83c1a..585b6b4303 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegion.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionAdapter.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionAdapter.cs index 15bb6498be..f039fd79b6 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionAdapter.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionAdapter.cs @@ -2,7 +2,7 @@ using System.Collections.Generic; using System.Windows; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehavior.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehavior.cs index 09cf57f9ef..70d378da9f 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehavior.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehavior.cs @@ -1,7 +1,7 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehaviorCollection.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehaviorCollection.cs index 1bee17200b..811ea66898 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehaviorCollection.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionBehaviorCollection.cs @@ -2,7 +2,7 @@ using System.Collections; using System.Collections.Generic; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs index 838445b505..0d8d251f19 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManager.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; using Prism.Ioc; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManagerAccessor.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManagerAccessor.cs index 765c540016..eb5b50ba32 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManagerAccessor.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockRegionManagerAccessor.cs @@ -2,7 +2,7 @@ using System; using System.Windows; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockSortableViews.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockSortableViews.cs index 75b4b0cc67..ffb78cb4df 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockSortableViews.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockSortableViews.cs @@ -1,6 +1,6 @@ -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockViewsCollection.cs b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockViewsCollection.cs index df4df2a950..c2361489fb 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Mocks/MockViewsCollection.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Mocks/MockViewsCollection.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; -using Prism.Regions; +using Prism.Navigation.Regions; namespace Prism.Wpf.Tests.Mocks { diff --git a/tests/Wpf/Prism.Wpf.Tests/PrismApplicationBaseFixture.cs b/tests/Wpf/Prism.Wpf.Tests/PrismApplicationBaseFixture.cs index 3333374065..56d54b79ba 100644 --- a/tests/Wpf/Prism.Wpf.Tests/PrismApplicationBaseFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/PrismApplicationBaseFixture.cs @@ -6,8 +6,8 @@ using Prism.Events; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Dialogs; using Xunit; @@ -259,7 +259,7 @@ protected override IContainerExtension CreateContainerExtension() protected override void ConfigureViewModelLocator() { ConfigureViewModelLocatorWasCalled = true; - //setting this breaks other tests using VML. + //setting this breaks other tests using VML. //We need to revist those tests to ensure it is being reset each time. //base.ConfigureViewModelLocator(); } diff --git a/tests/Wpf/Prism.Wpf.Tests/PrismBootstapperBaseFixture.cs b/tests/Wpf/Prism.Wpf.Tests/PrismBootstapperBaseFixture.cs index 3ec78d075c..eaf8154ebb 100644 --- a/tests/Wpf/Prism.Wpf.Tests/PrismBootstapperBaseFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/PrismBootstapperBaseFixture.cs @@ -6,8 +6,8 @@ using Prism.Events; using Prism.Ioc; using Prism.Modularity; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Dialogs; using Xunit; @@ -253,7 +253,7 @@ protected override IContainerExtension CreateContainerExtension() protected override void ConfigureViewModelLocator() { ConfigureViewModelLocatorWasCalled = true; - //setting this breaks other tests using VML. + //setting this breaks other tests using VML. //We need to revist those tests to ensure it is being reset each time. //base.ConfigureViewModelLocator(); } diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/AllActiveRegionFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/AllActiveRegionFixture.cs index 00cac8af80..f9260d5350 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/AllActiveRegionFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/AllActiveRegionFixture.cs @@ -1,7 +1,7 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs index a0903376ec..321dea66cb 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/AutoPopulateRegionBehaviorFixture.cs @@ -3,8 +3,8 @@ using System; using System.Collections.Generic; using Prism.Ioc; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/BindRegionContextToDependencyObjectBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/BindRegionContextToDependencyObjectBehaviorFixture.cs index 63f215da74..bd3e146086 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/BindRegionContextToDependencyObjectBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/BindRegionContextToDependencyObjectBehaviorFixture.cs @@ -1,7 +1,7 @@ -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/ClearChildViewsRegionBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/ClearChildViewsRegionBehaviorFixture.cs index 27664139f2..a5498594a7 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/ClearChildViewsRegionBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/ClearChildViewsRegionBehaviorFixture.cs @@ -1,7 +1,7 @@ -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/DelayedRegionCreationBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/DelayedRegionCreationBehaviorFixture.cs index 0bb878031f..5c955580fb 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/DelayedRegionCreationBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/DelayedRegionCreationBehaviorFixture.cs @@ -3,8 +3,8 @@ using System; using System.Linq; using System.Windows; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionActiveAwareBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionActiveAwareBehaviorFixture.cs index 35134270c5..d0f57ac893 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionActiveAwareBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionActiveAwareBehaviorFixture.cs @@ -3,8 +3,8 @@ using System; using System.Windows; using Moq; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs index 6635b65cc0..01b731341b 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionManagerRegistrationBehaviorFixture.cs @@ -5,8 +5,8 @@ using System.Windows.Controls; using Prism.Ioc; using Prism.Navigation; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionMemberLifetimeBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionMemberLifetimeBehaviorFixture.cs index 60a8f8cf2f..86b1cf1064 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionMemberLifetimeBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/RegionMemberLifetimeBehaviorFixture.cs @@ -1,8 +1,8 @@ using Moq; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SelectorItemsSourceSyncRegionBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SelectorItemsSourceSyncRegionBehaviorFixture.cs index 8d4e3cca3e..35c26fc137 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SelectorItemsSourceSyncRegionBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SelectorItemsSourceSyncRegionBehaviorFixture.cs @@ -6,8 +6,8 @@ using System.Windows.Controls; using System.Windows.Controls.Primitives; using System.Windows.Data; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SyncRegionContextWithHostBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SyncRegionContextWithHostBehaviorFixture.cs index 50d534595a..c58df04768 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SyncRegionContextWithHostBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/Behaviors/SyncRegionContextWithHostBehaviorFixture.cs @@ -3,8 +3,8 @@ using System; using System.Windows; using Prism.Common; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/ContentControlRegionAdapterFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/ContentControlRegionAdapterFixture.cs index d223e8531e..0027a4063a 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/ContentControlRegionAdapterFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/ContentControlRegionAdapterFixture.cs @@ -4,7 +4,7 @@ using System.Linq; using System.Windows.Controls; using System.Windows.Data; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/ItemsControlRegionAdapterFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/ItemsControlRegionAdapterFixture.cs index f2e119d7b5..8d4405cd3f 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/ItemsControlRegionAdapterFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/ItemsControlRegionAdapterFixture.cs @@ -6,7 +6,7 @@ using System.Linq; using System.Windows.Controls; using System.Windows.Data; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/LocatorNavigationTargetHandlerFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/LocatorNavigationTargetHandlerFixture.cs index 1f9717eae7..99fa6bba3f 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/LocatorNavigationTargetHandlerFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/LocatorNavigationTargetHandlerFixture.cs @@ -4,7 +4,7 @@ using System.Windows; using Moq; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs index dcdcc71a88..8823bb4d77 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationAsyncExtensionsFixture.cs @@ -3,7 +3,7 @@ using System; using Moq; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationContextFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationContextFixture.cs index 4751579522..f362adf918 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationContextFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/NavigationContextFixture.cs @@ -1,7 +1,7 @@ using System; using System.Linq; using Moq; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterBaseFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterBaseFixture.cs index 1b976130a8..c7c0da4b50 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterBaseFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterBaseFixture.cs @@ -1,7 +1,7 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterMappingsFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterMappingsFixture.cs index 78d18121e6..7c9c6f4608 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterMappingsFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionAdapterMappingsFixture.cs @@ -3,7 +3,7 @@ using System.Windows.Controls; using Moq; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorCollectionFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorCollectionFixture.cs index abe7dcfc9a..7b0aa6e0fa 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorCollectionFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorCollectionFixture.cs @@ -1,6 +1,6 @@ -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFactoryFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFactoryFixture.cs index c20db66a9c..24ec205a4a 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFactoryFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFactoryFixture.cs @@ -4,7 +4,7 @@ using System.Linq; using Moq; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFixture.cs index 9bb2747691..1a867b7d73 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionBehaviorFixture.cs @@ -1,7 +1,7 @@ using System; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs index a3f01dc1a6..66d69e91d5 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionFixture.cs @@ -4,7 +4,7 @@ using Moq; using Prism.Ioc; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs index 0c67c26307..2a33a938b7 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerFixture.cs @@ -4,7 +4,7 @@ using System.Threading.Tasks; using Moq; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs index 7c86855dfb..a6e1c4a270 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionManagerRequestNavigateFixture.cs @@ -1,7 +1,7 @@ using System; using Moq; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationJournalFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationJournalFixture.cs index a3ecf921d3..47d266c60d 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationJournalFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationJournalFixture.cs @@ -1,7 +1,7 @@ using System; using Moq; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs index 862a09dcd2..760a32cc76 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionNavigationServiceFixture.new.cs @@ -5,7 +5,7 @@ using Moq; using Prism.Ioc; using Prism.Navigation; -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs index 925e45b258..2db2a9609c 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/RegionViewRegistryFixture.cs @@ -4,7 +4,7 @@ using System.Windows; using Moq; using Prism.Ioc; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mvvm; using Xunit; diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/SelectorRegionAdapterFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/SelectorRegionAdapterFixture.cs index fdc3452290..ece315fdcc 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/SelectorRegionAdapterFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/SelectorRegionAdapterFixture.cs @@ -3,8 +3,8 @@ using System; using System.Threading.Tasks; using System.Windows.Controls; -using Prism.Regions; -using Prism.Regions.Behaviors; +using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Behaviors; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/SingleActiveRegionFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/SingleActiveRegionFixture.cs index 0483e041ad..944a223444 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/SingleActiveRegionFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/SingleActiveRegionFixture.cs @@ -1,6 +1,6 @@ -using Prism.Regions; +using Prism.Navigation.Regions; using Xunit; namespace Prism.Wpf.Tests.Regions diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs index afc2a2f4d1..4a31982117 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs @@ -6,7 +6,7 @@ using System.Collections.Specialized; using System.Linq; using System.Windows.Data; -using Prism.Regions; +using Prism.Navigation.Regions; using Prism.Wpf.Tests.Mocks; using Xunit; From 930e576ec6db2d93f8af599a4df93748b73a775b Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Mon, 4 Sep 2023 06:23:30 -0600 Subject: [PATCH 14/19] chore: update samples --- e2e/Forms/src/HelloRegions/RegionDemoModule.cs | 1 - .../src/HelloRegions/ViewModels/RegionDemoBase.cs | 4 +--- .../src/HelloRegions/ViewModels/ViewModelBase.cs | 12 ++++++------ e2e/Uno/Directory.Build.targets | 3 +-- e2e/Uno/HelloWorld/Views/Shell.xaml | 2 +- 5 files changed, 9 insertions(+), 13 deletions(-) diff --git a/e2e/Forms/src/HelloRegions/RegionDemoModule.cs b/e2e/Forms/src/HelloRegions/RegionDemoModule.cs index 6faa12e02b..f946d18707 100644 --- a/e2e/Forms/src/HelloRegions/RegionDemoModule.cs +++ b/e2e/Forms/src/HelloRegions/RegionDemoModule.cs @@ -1,4 +1,3 @@ -using System; using HelloRegions.ViewModels; using HelloRegions.Views; using Prism.Ioc; diff --git a/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs b/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs index 2cc51cf611..d7a606a397 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/RegionDemoBase.cs @@ -1,9 +1,7 @@ -using System; using Prism.Commands; using Prism.Mvvm; using Prism.Navigation; using Prism.Navigation.Regions; -using Prism.Navigation.Regions.Navigation; namespace HelloRegions.ViewModels { @@ -26,7 +24,7 @@ private void Navigate(string target) _regionManager.RequestNavigate(RegionName, target, NavigationCallback); } - private void NavigationCallback(IRegionNavigationResult result) + private void NavigationCallback(NavigationResult result) { } diff --git a/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs b/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs index 8e179a3b72..87cee7869e 100644 --- a/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs +++ b/e2e/Forms/src/HelloRegions/ViewModels/ViewModelBase.cs @@ -1,7 +1,7 @@ using System; using Prism.Commands; using Prism.Mvvm; -using Prism.Navigation.Regions.Navigation; +using Prism.Navigation.Regions; namespace HelloRegions.ViewModels { @@ -38,28 +38,28 @@ public bool IsActive set => SetProperty(ref _isActive, value, OnIsActiveChanged); } - private INavigationContext _context; - private INavigationContext Context + private NavigationContext _context; + private NavigationContext Context { get => _context; set => SetProperty(ref _context, value); } - public bool IsNavigationTarget(INavigationContext navigationContext) + public bool IsNavigationTarget(NavigationContext navigationContext) { Console.WriteLine($"{GetType().Name} IsNavigationTarget called"); var lookingFor = navigationContext.NavigatedName(); return _contextName == lookingFor; } - public void OnNavigatedFrom(INavigationContext navigationContext) + public void OnNavigatedFrom(NavigationContext navigationContext) { Context = navigationContext; Console.WriteLine($"{GetType().Name} NavigatedFrom"); } private string _contextName; - public void OnNavigatedTo(INavigationContext navigationContext) + public void OnNavigatedTo(NavigationContext navigationContext) { Context = navigationContext; _contextName = navigationContext.NavigatedName(); diff --git a/e2e/Uno/Directory.Build.targets b/e2e/Uno/Directory.Build.targets index 38c7058ee1..dbba02f980 100644 --- a/e2e/Uno/Directory.Build.targets +++ b/e2e/Uno/Directory.Build.targets @@ -1,4 +1,3 @@ - - + diff --git a/e2e/Uno/HelloWorld/Views/Shell.xaml b/e2e/Uno/HelloWorld/Views/Shell.xaml index e428fa9c31..604bd8565b 100644 --- a/e2e/Uno/HelloWorld/Views/Shell.xaml +++ b/e2e/Uno/HelloWorld/Views/Shell.xaml @@ -2,7 +2,7 @@ x:Class="HelloWorld.Views.Shell" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:pr="using:Prism.Regions" + xmlns:pr="using:Prism.Navigation.Regions" xmlns:pvm="using:Prism.Mvvm" pvm:ViewModelLocator.AutowireViewModel="true" xmlns:local="using:HelloWorld.Views" From 2838d27035582af5d9edde352d05441e7af61315 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 9 Sep 2023 17:46:00 -0600 Subject: [PATCH 15/19] chore: fixing Region Tests for Forms --- .../Ioc/RegionResolverOverrides.cs | 1 - .../Navigation/Regions/Region.cs | 6 +-- .../Properties/Resources.Designer.cs | 11 +++++- .../Properties/Resources.resx | 3 ++ .../Navigation/Regions/RegionViewException.cs | 39 +++++++++++++++++++ .../Tests/RegionFixture.cs | 2 +- .../Tests/RegionNavigationServiceFixture.cs | 24 ++++++++---- 7 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 src/Prism.Core/Navigation/Regions/RegionViewException.cs diff --git a/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs b/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs index a019f619bc..9ed0a5e898 100644 --- a/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs +++ b/src/Forms/Prism.Forms.Regions/Ioc/RegionResolverOverrides.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using Prism.Navigation; using Prism.Navigation.Regions; -using Prism.Navigation.Regions; namespace Prism.Ioc { diff --git a/src/Forms/Prism.Forms.Regions/Navigation/Regions/Region.cs b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Region.cs index 9ac413648f..8f1bcefbcf 100644 --- a/src/Forms/Prism.Forms.Regions/Navigation/Regions/Region.cs +++ b/src/Forms/Prism.Forms.Regions/Navigation/Regions/Region.cs @@ -282,12 +282,12 @@ private void InnerAdd(object view, string viewName, IRegionManager scopedRegionM { if (ItemMetadataCollection.FirstOrDefault(x => x.Item == view) != null) { - throw new InvalidOperationException(Resources.RegionViewExistsException); + throw new RegionViewException(Resources.RegionViewExistsException); } if (view is not VisualElement visualElement) { - throw new Exception("View is not a Visual Element"); + throw new RegionViewException(Resources.RegionViewIsNotVisualElementException); } var itemMetadata = new ItemMetadata(visualElement); @@ -295,7 +295,7 @@ private void InnerAdd(object view, string viewName, IRegionManager scopedRegionM { if (ItemMetadataCollection.FirstOrDefault(x => x.Name == viewName) != null) { - throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, Resources.RegionViewNameExistsException, viewName)); + throw new RegionViewException(string.Format(CultureInfo.InvariantCulture, Resources.RegionViewNameExistsException, viewName)); } itemMetadata.Name = viewName; } diff --git a/src/Forms/Prism.Forms.Regions/Properties/Resources.Designer.cs b/src/Forms/Prism.Forms.Regions/Properties/Resources.Designer.cs index 6f3de9544b..d737b72762 100644 --- a/src/Forms/Prism.Forms.Regions/Properties/Resources.Designer.cs +++ b/src/Forms/Prism.Forms.Regions/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace Prism.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] internal class Resources { @@ -290,6 +290,15 @@ internal static string RegionViewExistsException { } } + /// + /// Looks up a localized string similar to View is not a Visual Element.. + /// + internal static string RegionViewIsNotVisualElementException { + get { + return ResourceManager.GetString("RegionViewIsNotVisualElementException", resourceCulture); + } + } + /// /// Looks up a localized string similar to View with name '{0}' already exists in the region.. /// diff --git a/src/Forms/Prism.Forms.Regions/Properties/Resources.resx b/src/Forms/Prism.Forms.Regions/Properties/Resources.resx index e421f89102..0ccd4ef14f 100644 --- a/src/Forms/Prism.Forms.Regions/Properties/Resources.resx +++ b/src/Forms/Prism.Forms.Regions/Properties/Resources.resx @@ -203,6 +203,9 @@ View already exists in region. + + View is not a Visual Element. + View with name '{0}' already exists in the region. diff --git a/src/Prism.Core/Navigation/Regions/RegionViewException.cs b/src/Prism.Core/Navigation/Regions/RegionViewException.cs new file mode 100644 index 0000000000..fa865dd03f --- /dev/null +++ b/src/Prism.Core/Navigation/Regions/RegionViewException.cs @@ -0,0 +1,39 @@ +using System; +using System.Runtime.Serialization; + +namespace Prism.Navigation.Regions; + +/// +/// An exception when there is an issue with a View being added to a Region +/// +public sealed class RegionViewException : RegionException +{ + /// + /// Initializes a new + /// + public RegionViewException() + { + } + + /// + /// Initializes a new + /// + /// The Exception Message. + public RegionViewException(string message) : base(message) + { + } + + /// + public RegionViewException(SerializationInfo info, StreamingContext context) : base(info, context) + { + } + + /// + /// Initializes a new + /// + /// The Exception Message. + /// The Inner . + public RegionViewException(string message, Exception innerException) : base(message, innerException) + { + } +} diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs index 166e490a9e..911d2a5ea2 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionFixture.cs @@ -94,7 +94,7 @@ public void CanAddAndRetrieveNamedViewInstance() [Fact] public void AddingDuplicateNamedViewThrows() { - var ex = Assert.Throws(() => + var ex = Assert.Throws(() => { IRegion region = new Region(); diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs index 476c5cf418..ee55108df0 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs @@ -10,6 +10,7 @@ using Xamarin.Forms; using Xunit; using Region = Prism.Navigation.Regions.Region; +using NuGet.Frameworks; namespace Prism.Forms.Regions.Tests { @@ -1004,7 +1005,10 @@ public void WhenNavigatingWithNullCallback_ThenThrows() var region = new Region(); var navigationUri = new Uri("/", UriKind.Relative); - IContainerExtension container = new Mock().Object; + var containerMock = new Mock(); + containerMock.Setup(x => x.Resolve(typeof(IActiveRegionHelper))) + .Returns(new RegionResolverOverrides()); + var container = containerMock.Object; var contentLoader = new Mock(container).Object; IRegionNavigationJournal journal = Mock.Of(); @@ -1013,11 +1017,11 @@ public void WhenNavigatingWithNullCallback_ThenThrows() Region = region }; - ExceptionAssert.Throws( - () => - { - target.RequestNavigate(navigationUri); - }); + Exception ex = null; + target.RequestNavigate(navigationUri, x => ex = x.Exception); + + Assert.NotNull(ex); + Assert.IsType(ex); } [Fact] @@ -1040,7 +1044,11 @@ public void WhenNavigatingWithNoRegionSet_ThenMarshallExceptionToCallback() [Fact] public void WhenNavigatingWithNullUri_ThenMarshallExceptionToCallback() { - IContainerExtension container = new Mock().Object; + + var containerMock = new Mock(); + containerMock.Setup(x => x.Resolve(typeof(IActiveRegionHelper))) + .Returns(new RegionResolverOverrides()); + var container = containerMock.Object; var contentLoader = new Mock(container).Object; IRegionNavigationJournal journal = Mock.Of(); @@ -1053,7 +1061,7 @@ public void WhenNavigatingWithNullUri_ThenMarshallExceptionToCallback() target.RequestNavigate("", nr => error = nr.Exception); Assert.NotNull(error); - Assert.IsType(error); + Assert.IsType(error); } From db3f1c8d649c8686ea82126f6f26526826756674 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 9 Sep 2023 19:58:10 -0600 Subject: [PATCH 16/19] chore: update code format --- .../Ioc/RegionRegistrationExtensions.cs | 3 +-- src/Maui/Prism.Maui/Common/MvvmHelpers.cs | 12 ++++++------ src/Maui/Prism.Maui/Common/ObservableObject.cs | 2 +- .../Ioc/RegionNavigationRegistrationExtensions.cs | 3 +-- .../Prism.Maui/Navigation/Xaml/GoBackExtension.cs | 2 +- src/Prism.Core/Navigation/Regions/INavigateAsync.cs | 1 - src/Prism.Core/Navigation/Regions/IRegionBehavior.cs | 1 - .../Navigation/Regions/IRegionCollection.cs | 4 ++-- .../Navigation/Regions/UpdateRegionsException.cs | 8 ++++---- .../Tests/LocatorNavigationTargetHandlerFixture.cs | 3 +-- .../Tests/RegionAdapterBaseFixture.cs | 2 +- .../Tests/RegionNavigationServiceFixture.cs | 4 ++-- .../Tests/ViewsCollectionFixture.cs | 4 ++-- .../Fixtures/Regions/RegionFixture.cs | 2 +- .../Regions/ViewsCollectionFixture.cs | 4 ++-- 15 files changed, 25 insertions(+), 30 deletions(-) diff --git a/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs b/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs index 0d47e34c5e..41a219f9c4 100644 --- a/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs +++ b/src/Forms/Prism.Forms.Regions/Ioc/RegionRegistrationExtensions.cs @@ -1,9 +1,8 @@ -using System; +using System; using Prism.Navigation.Regions; using Prism.Navigation.Regions.Adapters; using Prism.Navigation.Regions.Behaviors; using Prism.Navigation.Regions.Navigation; -using Prism.Navigation.Regions; using Xamarin.Forms; namespace Prism.Ioc diff --git a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs index 2d91c56c4f..7014445ff2 100644 --- a/src/Maui/Prism.Maui/Common/MvvmHelpers.cs +++ b/src/Maui/Prism.Maui/Common/MvvmHelpers.cs @@ -1,8 +1,8 @@ using System.ComponentModel; using System.Reflection; using Prism.Navigation; -using Prism.Navigation.Xaml; using Prism.Navigation.Regions; +using Prism.Navigation.Xaml; using NavigationMode = Prism.Navigation.NavigationMode; using TabbedPage = Microsoft.Maui.Controls.TabbedPage; @@ -22,10 +22,10 @@ public static void InvokeViewAndViewModelAction(object view, Action action action(viewModelAsT); } - if(view is Page page) + if (view is Page page) { var children = page.GetChildRegions(); - if(children is not null) + if (children is not null) foreach (var child in children) InvokeViewAndViewModelAction(child, action); } @@ -46,7 +46,7 @@ public static async Task InvokeViewAndViewModelActionAsync(object view, Func< if (view is Page page) { var children = page.GetChildRegions(); - if(children is not null) + if (children is not null) foreach (var child in children) await InvokeViewAndViewModelActionAsync(child, action); } @@ -60,7 +60,7 @@ public static void DestroyPage(IView view) InvokeViewAndViewModelAction(view, v => v.Destroy()); - if(view is Page page) + if (view is Page page) { page.Behaviors?.Clear(); page.BindingContext = null; @@ -301,7 +301,7 @@ public static async Task HandleNavigationPageGoBack(NavigationPage navigationPag { var navigationService = Navigation.Xaml.Navigation.GetNavigationService(navigationPage.CurrentPage); var result = await navigationService.GoBackAsync(); - if(result.Exception is NavigationException navEx && navEx.Message == NavigationException.CannotPopApplicationMainPage) + if (result.Exception is NavigationException navEx && navEx.Message == NavigationException.CannotPopApplicationMainPage) { Application.Current.Quit(); } diff --git a/src/Maui/Prism.Maui/Common/ObservableObject.cs b/src/Maui/Prism.Maui/Common/ObservableObject.cs index 5ffa340839..814e26ed29 100644 --- a/src/Maui/Prism.Maui/Common/ObservableObject.cs +++ b/src/Maui/Prism.Maui/Common/ObservableObject.cs @@ -24,4 +24,4 @@ public T Value get => (T)GetValue(ValueProperty); set => SetValue(ValueProperty, value); } -} \ No newline at end of file +} diff --git a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs index 00d85a4692..2edbc23519 100644 --- a/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs +++ b/src/Maui/Prism.Maui/Ioc/RegionNavigationRegistrationExtensions.cs @@ -1,10 +1,9 @@ -using Microsoft.Maui.Controls.Compatibility; +using Microsoft.Maui.Controls.Compatibility; using Prism.Mvvm; using Prism.Navigation.Regions; using Prism.Navigation.Regions.Adapters; using Prism.Navigation.Regions.Behaviors; using Prism.Navigation.Regions.Navigation; -using Prism.Navigation.Regions; namespace Prism.Ioc; diff --git a/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs b/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs index 0ba9073016..8da35f53f8 100644 --- a/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs +++ b/src/Maui/Prism.Maui/Navigation/Xaml/GoBackExtension.cs @@ -29,4 +29,4 @@ await navigationService.GoBackToRootAsync(parameters) : Log(result.Exception, parameters); } } -} \ No newline at end of file +} diff --git a/src/Prism.Core/Navigation/Regions/INavigateAsync.cs b/src/Prism.Core/Navigation/Regions/INavigateAsync.cs index 9fbea95ec9..ccfc23ff9b 100644 --- a/src/Prism.Core/Navigation/Regions/INavigateAsync.cs +++ b/src/Prism.Core/Navigation/Regions/INavigateAsync.cs @@ -1,5 +1,4 @@ using System; -using Prism.Navigation; namespace Prism.Navigation.Regions { diff --git a/src/Prism.Core/Navigation/Regions/IRegionBehavior.cs b/src/Prism.Core/Navigation/Regions/IRegionBehavior.cs index 0aeb6b3853..efd0af3e2f 100644 --- a/src/Prism.Core/Navigation/Regions/IRegionBehavior.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionBehavior.cs @@ -14,6 +14,5 @@ public interface IRegionBehavior /// Attaches the behavior to the specified region. /// void Attach(); - } } diff --git a/src/Prism.Core/Navigation/Regions/IRegionCollection.cs b/src/Prism.Core/Navigation/Regions/IRegionCollection.cs index 628626cba7..d24a1db191 100644 --- a/src/Prism.Core/Navigation/Regions/IRegionCollection.cs +++ b/src/Prism.Core/Navigation/Regions/IRegionCollection.cs @@ -37,10 +37,10 @@ public interface IRegionCollection : IEnumerable, INotifyCollectionChan bool ContainsRegionWithName(string regionName); /// - /// Adds a region to the with the name received as argument. + /// Adds a region to the with the name received as argument. /// /// The name to be given to the region. - /// The region to be added to the . + /// The region to be added to the . /// Thrown if is . /// Thrown if and 's name do not match and the is not . void Add(string regionName, IRegion region); diff --git a/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs b/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs index dcbb060669..ca2c7dea0a 100644 --- a/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs +++ b/src/Prism.Core/Navigation/Regions/UpdateRegionsException.cs @@ -38,10 +38,10 @@ public UpdateRegionsException(string message, Exception inner) } /// - /// Initializes a new instance of the class with serialized data. - /// - /// The that holds the serialized object data about the exception being thrown. - /// The that contains contextual information about the source or destination. + /// Initializes a new instance of the class with serialized data. + /// + /// The that holds the serialized object data about the exception being thrown. + /// The that contains contextual information about the source or destination. protected UpdateRegionsException(SerializationInfo info, StreamingContext context) : base(info, context) { diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs index 460251d50f..6a89d014b5 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/LocatorNavigationTargetHandlerFixture.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using System.Text; using Moq; @@ -6,7 +6,6 @@ using Prism.Ioc.Internals; using Prism.Navigation.Regions; using Prism.Navigation.Regions.Navigation; -using Prism.Navigation.Regions; using Xamarin.Forms; using Xunit; using Region = Prism.Navigation.Regions.Region; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs index bfda2cbef8..9750429107 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionAdapterBaseFixture.cs @@ -2,8 +2,8 @@ using System.Collections.Generic; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Navigation.Regions.Adapters; using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Adapters; using Xamarin.Forms; using Xunit; diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs index ee55108df0..b866b0bfff 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/RegionNavigationServiceFixture.cs @@ -2,15 +2,15 @@ using System.Collections.Generic; using System.Linq; using Moq; +using NuGet.Frameworks; using Prism.Ioc; using Prism.Navigation; -using Prism.Navigation.Regions.Navigation; using Prism.Navigation.Regions; using Prism.Navigation.Regions.Navigation; +using Prism.Navigation.Regions.Navigation; using Xamarin.Forms; using Xunit; using Region = Prism.Navigation.Regions.Region; -using NuGet.Frameworks; namespace Prism.Forms.Regions.Tests { diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs index 298aaf8520..93c7083899 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ViewsCollectionFixture.cs @@ -117,7 +117,7 @@ public void CollectionChangedPassesWrappedItemInArgumentsWhenAdding() originalCollection.Remove(filteredInObject); Assert.NotNull(oldItemsPassed); - Assert.Equal(1, oldItemsPassed.Count); + Assert.Single(oldItemsPassed); Assert.Same(filteredInObject.Item, oldItemsPassed[0]); } @@ -133,7 +133,7 @@ public void CollectionChangedPassesWrappedItemInArgumentsWhenRemoving() originalCollection.Add(filteredInObject); Assert.NotNull(newItemsPassed); - Assert.Equal(1, newItemsPassed.Count); + Assert.Single(newItemsPassed); Assert.Same(filteredInObject.Item, newItemsPassed[0]); } diff --git a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs index 83e8131804..e9da8315a8 100644 --- a/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs +++ b/tests/Maui/Prism.DryIoc.Maui.Tests/Fixtures/Regions/RegionFixture.cs @@ -112,7 +112,7 @@ public void RegionViewModel_HasPageAccessor_WithCorrectPage() [Fact] public void RegionManager_HasTwoRegions() { - var mauiApp = CreateBuilder(prism => + var mauiApp = CreateBuilder(prism => prism.RegisterTypes(container => { container.RegisterForNavigation(); diff --git a/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs b/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs index 4a31982117..c24c295927 100644 --- a/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs +++ b/tests/Wpf/Prism.Wpf.Tests/Regions/ViewsCollectionFixture.cs @@ -117,7 +117,7 @@ public void CollectionChangedPassesWrappedItemInArgumentsWhenAdding() originalCollection.Remove(filteredInObject); Assert.NotNull(oldItemsPassed); - Assert.Equal(1, oldItemsPassed.Count); + Assert.Single(oldItemsPassed); Assert.Same(filteredInObject.Item, oldItemsPassed[0]); } @@ -133,7 +133,7 @@ public void CollectionChangedPassesWrappedItemInArgumentsWhenRemoving() originalCollection.Add(filteredInObject); Assert.NotNull(newItemsPassed); - Assert.Equal(1, newItemsPassed.Count); + Assert.Single(newItemsPassed); Assert.Same(filteredInObject.Item, newItemsPassed[0]); } From ac2894e5f8a9df304c4709cfdcd0cda6256d4ff6 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 9 Sep 2023 19:59:41 -0600 Subject: [PATCH 17/19] chore: update code format action --- .github/workflows/dotnet-format.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index b25ada1d9d..3eb7e8ec2f 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -26,5 +26,5 @@ jobs: uses: jfversluis/dotnet-format@v1.0.9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - only-changed-files: true + only-changed-files: false workspace: "PrismLibrary.sln" From e1b2f04fdcbc268fcd5450072018bbc63a955891 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 9 Sep 2023 20:27:38 -0600 Subject: [PATCH 18/19] chore: Code formatting --- src/Prism.Core/Navigation/NavigationException.cs | 2 +- .../Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs | 2 +- .../Tests/ContentViewRegionAdapterFixture.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Prism.Core/Navigation/NavigationException.cs b/src/Prism.Core/Navigation/NavigationException.cs index f1d39146bb..d8fefebe07 100644 --- a/src/Prism.Core/Navigation/NavigationException.cs +++ b/src/Prism.Core/Navigation/NavigationException.cs @@ -42,7 +42,7 @@ public NavigationException(string message, string navigationKey, Exception inner { } - public NavigationException(string message, object view, Exception innerException) + public NavigationException(string message, object view, Exception innerException) : this(message, null, view, innerException) { } diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs index 740d7da8d0..759698526c 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Mocks/MockRegionAdapter.cs @@ -17,7 +17,7 @@ public IRegion Initialize(object regionTarget, string regionName) var region = new MockPresentationRegion(); if (regionTarget is VisualElement element) - RegionManager.GetObservableRegion(element).Value = region; + RegionManager.GetObservableRegion(element).Value = region; // Fire update regions again. This also happens if a region is created and added to the RegionManager if (Accessor != null) diff --git a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs index eef3b6d59c..89acaa4860 100644 --- a/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs +++ b/tests/Forms/Prism.Forms.Regions.Tests/Tests/ContentViewRegionAdapterFixture.cs @@ -3,8 +3,8 @@ using System.Linq; using System.Text; using Prism.Forms.Regions.Mocks; -using Prism.Navigation.Regions.Adapters; using Prism.Navigation.Regions; +using Prism.Navigation.Regions.Adapters; using Xamarin.Forms; using Xunit; From fa30fb457e319d4399594b11d61270ba5fc89d28 Mon Sep 17 00:00:00 2001 From: Dan Siegel Date: Sat, 9 Sep 2023 20:28:16 -0600 Subject: [PATCH 19/19] chore: disable code format check --- .github/workflows/dotnet-format.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dotnet-format.yml b/.github/workflows/dotnet-format.yml index 3eb7e8ec2f..60c2dce23d 100644 --- a/.github/workflows/dotnet-format.yml +++ b/.github/workflows/dotnet-format.yml @@ -21,10 +21,10 @@ jobs: with: ref: ${{ github.head_ref }} - - name: Run dotnet format - id: format - uses: jfversluis/dotnet-format@v1.0.9 - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - only-changed-files: false - workspace: "PrismLibrary.sln" + # - name: Run dotnet format + # id: format + # uses: jfversluis/dotnet-format@v1.0.9 + # with: + # repo-token: ${{ secrets.GITHUB_TOKEN }} + # only-changed-files: false + # workspace: "PrismLibrary.sln"