public void Logout () { UserData.Save (null); Properties ["Session"] = null; MainPage = new LoginPage (); }
public App () { SetStyles (); Current = this; var service = new RestService (); var loginResponse = UserData.Load (); if (loginResponse == null) { loginResponse = Properties.ContainsKey("Session") ? (LoginResponse)Properties ["Session"] : null; } if (loginResponse != null) { // Verifica a sessao na API if (service.CheckSession (loginResponse.Token)) { // Se estiver OK, inicia normalmente Properties["Session"] = loginResponse; ShowMainPage(loginResponse); } else { MainPage = new LoginPage (); } } else MainPage = new LoginPage (); }
public void ShowMainPage (LoginResponse loginResponse) { if (loginResponse != null) { UserData.Save (loginResponse); if (loginResponse.AlterarSenha) { MainPage = new ChangePasswordPage (); } else if (loginResponse.IsEmpregado) { RestService rest = new RestService (); Empregado empregado = rest.GetEmployee (loginResponse.Token); MainPage = new EmployeeMainPage (empregado, loginResponse.QtdVisualizacoes); } else { MainPage = new NavigationPage (new CNE.MainPage ()); } } else { MainPage = new LoginPage (); } }