Esempio n. 1
0
        public App()
        {
            InitializeComponent();

            ImageCircleRenderer.Init();

            UserResponse userResponse = new UserResponse(); // Para hacer queries a User

            if ((Xamarin.Forms.Application.Current.Properties.ContainsKey("jwt")))
            {
                if (Current.Properties["jwt"] == null || Current.Properties["jwt"].ToString() == "")
                {
                    MainPage = new LandingView();
                }
                else
                {
                    if (userResponse.VerifyToken(Current.Properties["jwt"].ToString()))
                    {
                        MainPage = new MainMasterDetailView();
                    }
                    else
                    {
                        MainPage = new LandingView();
                    }
                }
            }
            else
            {
                MainPage = new LandingView();
            }
        }
Esempio n. 2
0
        private void LogoutClicked(object sender, EventArgs e)
        {
            Application.Current.Properties["jwt"]   = "";
            Application.Current.Properties["email"] = "";

            LandingView loginView = new LandingView();

            Application.Current.MainPage = loginView;
        }
Esempio n. 3
0
        private void PopupButtonClicked(object sender, EventArgs e)
        {
            if (isSuccessOrNot) // Caso de éxito
            {
                switch (pressOrigin)
                {
                case 1:     // Crear cuenta
                    LoginView loginView = new LoginView();
                    Application.Current.MainPage = loginView;

                    PopupNavigation.PopAsync();
                    break;

                case 2:     // Eliminar cuenta
                    LandingView landingView = new LandingView();
                    Application.Current.MainPage = landingView;

                    PopupNavigation.PopAsync();
                    break;

                default:
                    break;
                }
            }
            else // Error
            {
                switch (pressOrigin)
                {
                case 1:     // Crear cuenta

                    PopupNavigation.PopAsync();
                    break;

                case 2:     // Eliminar cuenta

                    PopupNavigation.PopAsync();
                    break;

                case 3:     // Login campos vacíos

                    PopupNavigation.PopAsync();
                    break;

                case 4:     // Login email sin formato correcto

                    PopupNavigation.PopAsync();
                    break;

                case 5:     // Login contraseña corta

                    PopupNavigation.PopAsync();
                    break;

                case 6:     // Login email o contraseña incorrectos

                    PopupNavigation.PopAsync();
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 4
0
        private void BackClicked(object sender, EventArgs e)
        {
            LandingView landingView = new LandingView();

            Application.Current.MainPage = landingView;
        }