/// <summary> Decides where user will be redirected to, if logged in already skip login. </summary> private void InitNavigation() { // Check if we are logged in, if we are go to main page, else go to login. var loggedIn = SecureStorage.GetAsync("IsLoggedIn").Result; if (loggedIn == "1") { var lastUserId = SecureStorage.GetAsync("LastUserId").Result; int.TryParse(lastUserId, out var userId); var user = Database.GetUserByUserId(userId); if (user.Result.IsAdmin) { MainPage = new AdminAppShell(); } else { MainPage = new AppShell(); } } else { MainPage = new AuthenticationAppShell(); } }
protected void AppShellSelector() { var isLoogged = Xamarin.Essentials.SecureStorage.GetAsync("isLogged").Result; if (isLoogged == "1") { Enum.TryParse(Xamarin.Essentials.SecureStorage.GetAsync("Role").Result, out Role role); if (role == Role.Mobilizer) { MainPage = new Mobilizerappshell(); } else if (role == Role.Supervisor) { MainPage = new SupervisorShell(); } else if (role == Role.Parent) { MainPage = new ParentShell(); } else if (role == Role.Admin) { MainPage = new AdminAppShell(); } else { MainPage = new AccessShell(); } } else { MainPage = new AccessShell(); } }