Ejemplo n.º 1
0
        void OnRegisterTouched(object sender, EventArgs e)
        {
            User userToRegist = new User(txtName.Text, txtPassword1.Text, txtMail.Text);

            Task.Run(() =>
            {
                db.saveUser(userToRegist);
                Notification notification = new Notification
                {
                    Title   = "Registro correcto",
                    Message = "Registrado como: " + userToRegist.Name +
                              " con password: "******" y email: " + userToRegist.Email,
                    Vibrate = Preferencias.getVibracion()
                };
                CrossNotifications.Current.Send(notification);
            });
        }
Ejemplo n.º 2
0
        void OnLoginTouched(object sender, EventArgs e)
        {
            User user    = new User(txtName.Text, txtPassword.Text, "*****@*****.**");
            bool loginOK = false;

            Task t = Task.Run(() =>
            {
                loginOK = db.checkLogin(user).Result;
                Notification notification;
                if (loginOK)
                {
                    notification = new Notification
                    {
                        Title   = "Login correcto",
                        Message = "Logeado como: " + user.Name,
                        Vibrate = Preferencias.getVibracion()
                    };
                }
                else
                {
                    notification = new Notification
                    {
                        Title   = "Login incorrecto",
                        Message = "Nombre o contraseña erróneos",
                        Vibrate = Preferencias.getVibracion()
                    };
                }
                CrossNotifications.Current.Send(notification);
            });

            while (!t.IsCompleted)
            {
                if (loginOK)
                {
                    Navigation.PushModalAsync(new ListarChats(user));
                }
            }
        }