Go back to PageModel navigartion from PageRenderer

172 views Asked by At

I got a little issue, I don't know how to go back to my PageModel and continue the navigation after using a PageRenderer. I'm trying to implement FacebookLogin on my app, so I'm using a pageRenderer in order to set the facebook authentification page and use it to get back user information. The issue is that when the user press login, I process all his informations and so on, but, I absolutely don't know what to do after that to continue my navigation.

thanks

edit

Here what I tried in one of my class :

var mainContainer = new FreshMasterDetailNavigationContainer(NavigationContainerNames.MainContainer);
        mainContainer.Init("Menu");
        mainContainer.AddPage<ActivityFeedListPageModel>("ActivityFeed", new User());
        mainContainer.AddPage<ProfilePageModel>("Profile", new User());
        App.Current.MainPage = mainContainer;

After that it's said in the documentation tu use CoreMethods.SwitchOutRootNavigation(NavigationContainerNames.MainContainer); but I don't know how to do it from here.

1

There are 1 answers

2
Timo Salomäki On

I'd try it with two separate navigation stacks. One for the login process and one for the main application. You can see an example of this by the original author of FreshMVVM:

LoginPage with FreshMVVM

It's also worth checking the GitHub page where the Navigation service is also discussed.

Switcing out NavigationStacks on the Xamarin.Forms MainPage


Edit: Related to your update, here's what you can try.

CoreMethods is a member of the FreshBasePageModel which all your PageModel's should already inherit. This means that you can call SwitchOutRootNavigation within any of your PageModels.