Skip to content

Instantly share code, notes, and snippets.

@scionwest
Created December 6, 2014 20:49
Show Gist options
  • Save scionwest/0bd98de7af7546216912 to your computer and use it in GitHub Desktop.
Save scionwest/0bd98de7af7546216912 to your computer and use it in GitHub Desktop.
App Startup
protected async override Task OnLaunchApplicationAsync(LaunchActivatedEventArgs args)
{
try
{
// Try to restore the user.
IUserService userService = this.container.Resolve<IUserService>();
User user = await userService.RetrieveUser();
// If the user was restored, we can navigate to the main page.
NavigationService.Navigate("Main", user);
}
catch (UserNotAuthenticatedException)
{
// If the user restore failed, they must sign back in.
NavigationService.Navigate("FirstRun", null);
}
Window.Current.Activate();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment