コード例 #1
0
ファイル: Login.cs プロジェクト: Cesarmhepp/GlucometerV5
        private void MprofileTracker_mOnProfileChanged(object sender, OnProfileChangedEventArgs e)
        {
            if (e.mProfile != null)
            {
                try
                {
                    Profile p    = e.mProfile;
                    int     idUS = bd.loginfacebook(p.Id);
                    if (idUS != 0)//consulta para iniciar sesion
                    {
                        Intent i   = new Intent(this, typeof(Inicio));
                        string aux = Convert.ToString(idUS);
                        i.PutExtra("idUs", aux);
                        StartActivity(i);
                    }
                    else
                    {
                        AlertDialog alerta = new AlertDialog.Builder(this).Create();
                        alerta.SetTitle("Error ");
                        alerta.SetMessage("FB no esta enlazado a ninguna cuenta de usuario");
                        alerta.SetButton("Aceptar", (a, b) => { });
                        alerta.Show();
                    }

                    // tengo que crear el layout del  config y pasar los datos a una sesion para almacenarlos entre pestañas
                }
                catch (Java.Lang.Exception ex) { }
            }
            else
            {
            }
        }
コード例 #2
0
ファイル: ConfigUs.cs プロジェクト: Cesarmhepp/GlucometerV5
        private void MprofileTracker_mOnProfileChangedconfig(object sender, OnProfileChangedEventArgs e)
        {
            if (e.mProfile != null)
            {
                try
                {
                    CrudUsuario bd         = new CrudUsuario();
                    Profile     p          = e.mProfile;
                    bool        encontrado = bd.BuscaridF(idUS, e.mProfile.Id);
                    if (auxF)           // si ya paso una vez hay que reiniciar la actividad para que se pueda volver a asociar
                    {
                        if (encontrado) //si encuentra el usuario y fb entra al metodo que elimina el id de fb del usuario
                        {
                            bd.Eliminarfb(idUS);
                        }
                        else
                        {
                            bd.Agregarfb(idUS, e.mProfile.Id);
                        }
                    }

                    // tengo que crear el layout del  config y pasar los datos a una sesion para almacenarlos entre pestañas
                }
                catch (Java.Lang.Exception ex) { }
            }
            else
            {
            }

            auxF = false;
        }