Exemplo n.º 1
0
        async void LoginClicked(object sender, System.EventArgs e)
        {
            if (ValidateUI())
            {
                CheckConnection();
                ShowProgress("Validando");
                var response = await ClientGuanajoven.signin(_email.Text, _password.Text);

                // checkError(response);
                if (ValidateResponse(response, checkError(response)))
                {
                    var user     = JsonConvert.DeserializeObject <ResponseUsuario>(response);
                    var posicion = await ClientGuanajoven.getPosition(user.data.api_token);

                    user.data.posicion = ClientGuanajoven.Data(posicion);
                    PropertiesManager.SaveUserInfo(user);
                    FirebaseObject firebase = new FirebaseObject();
                    firebase.os           = "ios";
                    firebase.id_usuario   = user.data.id + "";
                    firebase.device_token = App.CurrentApp.DeviceToken;                     //id de firebase_rg
                    var sendtoken = await ClientGuanajoven.getIdFirebase(firebase);

                    ShowProgress(IProgressType.LogedIn);
                    await Task.Delay(600);

                    HideProgress();
                    await Navigation.PushModalAsync(new HomeDrawerPage());
                }
                HideProgress();
            }
        }