Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use it with Login page #74

Open
Ramesh209025 opened this issue May 3, 2017 · 1 comment
Open

How to use it with Login page #74

Ramesh209025 opened this issue May 3, 2017 · 1 comment

Comments

@Ramesh209025
Copy link

From AppDelegate i need to present LoginPage ,from On Success of Login i need to show Actual content view with slider ,but in provided samples of this component in AppDelete itself rootviewController of side menu has been set as UIWindow root viewController .but how can i show my login page and then move to Content page , need little help, kid in xamarin :(

@kmiterror
Copy link

An old question but since nobody tried to explain I'll try to give two approaches. Perhaps it will be helpful for others.

First option
Remmber RootViewController of current window, and replace it with logon screen viewcontroller.
After successful logon switch back to previously remmbered RootViewController

in AppDelegate.cs

messenger.Subscribe<LogoutMessage>(res => {
   Storyboard = UIStoryboard.FromName("Logon", null);
   initialViewController = Storyboard.InstantiateInitialViewController();
   previousRootController = Window.RootViewController;
   Window.RootViewController = initialViewController;
});

and after logon sucesfull:

messenger.Subscribe<LogonSuccessfulMessage>(success => {             
   Window.RootViewController = previousRootController;
});

Second option
Create separate "window" for login page and properly shuffle it.
Calling MakeKeyAndVisible on a window makes this window visible to the user.

messenger.Subscribe<LogonNeededMessage>(res => {
   var logonWindow = new UIWindow();
   logonWindow.RootViewController = logonViewController;
   logonWindow.MakeKeyAndVisible();
});
messenger.Subscribe<LogonSuccessfulMessage>(success => {             
   Window.MakeKeyAndVisible();
});

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants