You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Feb 16, 2023. It is now read-only.
Due to Navigation being Page based with Xamarin.Forms -> .NET Maui, the Navigation Service has a hard requirement that it can not be a Singleton. This creates a complication as there has been no good way of dealing with Navigation on a global basis. While the Page based navigation requirement is not changing, what we can do is expose NavigationEvent that can be published with Prism's IEventAggregator. Consuming applications can then either listen for and respond to the event. We could also introduce a plugin package to wrap this into an IObservable. As the event would contain the full context of the navigation this would also help us to ensure that you could maintain the current Navigation Uri.
Proposal
publicenumNavigationType{Navigate,GoBack,GoToRoot,}publicrecordNavigationContext{publicNavigationTypeType{get;init;}// Only has a value when NavigationType is NavigatepublicUri?RequestUri{get;init;}publicINavigationParametersParameters{get;init;}publicINavigationResultResult{get;init;}}publicclassNavigationEvent:PubSubEvent<NavigationContext>{}
Implementation
Currently Prism's Navigation Service has a number of places where we return the INavigationResult typically something like:
returnnewNavigationResult{Success=true};
This would be updated to call a helper method which would return the NavigationResult and publish the event something like:
// Called by GoBack & GoToRootprotectedINavigationResultNotify(NavigationTypetype,INavigationParametersparameters,INavigationResultresult){_ea.GetEvent<NavigationEvent>().Publish(newNavigationContext{Type=type,Parameters=parameters,Result=result,});returnresult;}// called by NavigateprotectedINavigationResultNotify(Uriuri,INavigationParametersparameters,INavigationResultresult){_ea.GetEvent<NavigationEvent>().Publish(newNavigationContext{Type=NavigationType.Navigate,RequestUri=uri,Parameters=parameters,Result=result,});returnresult;}
The text was updated successfully, but these errors were encountered:
Description
Due to Navigation being Page based with Xamarin.Forms -> .NET Maui, the Navigation Service has a hard requirement that it can not be a Singleton. This creates a complication as there has been no good way of dealing with Navigation on a global basis. While the Page based navigation requirement is not changing, what we can do is expose NavigationEvent that can be published with Prism's IEventAggregator. Consuming applications can then either listen for and respond to the event. We could also introduce a plugin package to wrap this into an IObservable. As the event would contain the full context of the navigation this would also help us to ensure that you could maintain the current Navigation Uri.
Proposal
Implementation
Currently Prism's Navigation Service has a number of places where we return the
INavigationResult
typically something like:This would be updated to call a helper method which would return the NavigationResult and publish the event something like:
The text was updated successfully, but these errors were encountered: