Example #1
0
        async void signOut(object sender, EventArgs args)
        {
            Console.WriteLine("Sign Out action");
            var answer = await DisplayAlert("", "¿Deseas cerrar sesión?", "Si", "No");

            if (answer)
            {
                AuthModel.DeleteCredentials();
                Application.Current.Properties.Clear();
                await Application.Current.SavePropertiesAsync();

                await Navigation.PushAsync(new Login());
            }
        }
Example #2
0
        public static async System.Threading.Tasks.Task <bool> manageResponseAsync(HttpResponseMessage response)
        {
            Console.WriteLine("dato de pagina");
            //Console.WriteLine(page);

            string resposeStatus = response.StatusCode.ToString();

            if (resposeStatus == "OK")
            {
                return(true);
            }

            else
            {
                if (resposeStatus == "Unauthorized")
                {
                    if (Application.Current.MainPage.ToString() == "vip.Login")
                    {
                        await Application.Current.MainPage.DisplayAlert("Espera", "Las credenciales no son validas.", "OK");
                    }
                    else
                    {
                        await Application.Current.MainPage.DisplayAlert("Espera", "Error de autorización.", "OK");

                        AuthModel.DeleteCredentials();
                        await Application.Current.MainPage.Navigation.PushAsync(new Login());
                    }

                    return(false);
                }
                else
                {
                    await Application.Current.MainPage.DisplayAlert("Error", "Existe un error en el servidor.", "OK");

                    return(false);
                }

                //return false;
            }
        }