public override async void OnShow() { var user = ReadUserSecurityService.ReadUser(); if (user != null) { if (string.IsNullOrEmpty(user.Username)) { await Navigation.PushAsync(new EnterUsernamePage(user)); return; } try { DialogService.ShowLoading("Authenticating..."); StartupService.SetUser(user); // need to validate that the token is still valid var loginValid = await LoginUserService.CheckUserTokenAsync(); if (loginValid) { DialogService.HideLoading(); await Navigation.PushModalAsync(new ScorePredictNavigationPage(new MainPage())); } else { ClearUserSecurityService.ClearUserSecurity(); DialogService.Alert("You session has expired. Please log in again"); } } finally { DialogService.HideLoading(); } } }