static void Init(HomeActivity context)
 {
     instance = context;
 }
        public void CallApi()
        {
            progressBar.Visibility         = ViewStates.Visible;
            contentLinearLayout.Visibility = ViewStates.Gone;

            Task.Factory.StartNew(() =>
            {
                //Armando el objeto para consumir API movements
                //No borrar Declara o nó

                var header = new Models.Request.Movements.Header
                {
                    token = HomeActivity.GetInstance().access_token,
                };

                var datum = new Models.Request.Movements.Datum
                {
                    header = header,
                };

                var requestModel = new Models.Request.Movements.RootObject
                {
                    data = new List <Models.Request.Movements.Datum>()
                };
                requestModel.data.Add(datum);



                var ResponseValiateStatement = ApiService.PostGetMovements(
                    Constants.Url.MovementsServicePrefix,
                    requestModel).Result;

                if (!ResponseValiateStatement.IsSuccess)
                {
                    RunOnUiThread(() =>
                    {
                        progressBar.Visibility = Android.Views.ViewStates.Gone;
                        Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                        AlertDialog alert = dialog.Create();
                        alert.SetTitle("ALERTA");
                        alert.SetMessage("Hubo un error inesperado");
                        alert.SetButton("ACEPTAR", (c, ev) =>
                                        { CallApi(); });
                        alert.SetButton2("CANCEL", (c, ev) => {
                            Finish();
                        });
                        alert.Show();
                        return;
                    });
                }

                RunOnUiThread(() =>
                {
                    progressBar.Visibility         = Android.Views.ViewStates.Gone;
                    contentLinearLayout.Visibility = Android.Views.ViewStates.Visible;
                });
                var Movements = (Models.Responses.Movements.RootObject)ResponseValiateStatement.Result;
                if (Movements.data[0].header.Status == 200)
                {
                    if (Movements.data[0].declaration)
                    {
                        //TODO: Crear intent para que salga que debe declarar
                        RunOnUiThread(() =>
                        {
                            capable.Text = "Por la suma de tus ingresos anuales, eres contribuyente y debes hacer la declaración de renta ante la DIAN";
                        });
                        return;
                    }

                    // TODO: No declara
                    RunOnUiThread(() =>
                    {
                        capable.Text = "Por la suma de tus ingresos anuales, no eres contribuyente y no debes hacer la declaración de renta ante la DIAN";
                    });
                }
            });
        }
        public void CallApi()
        {
            progressBar.Visibility         = ViewStates.Visible;
            contentLinearLayout.Visibility = ViewStates.Gone;

            Task.Factory.StartNew(() =>
            {
                //UpdateClient
                var clientInfo = new Models.Request.UpdateClient.Datum
                {
                    address   = address.Text,
                    cellPhone = cellphone.Text,
                    email     = email.Text,
                    firstName = name.Text,
                    lastName  = lastname.Text,
                    phone     = cellphone.Text,
                    ocupation = work.Text,
                };

                var arrayListDataFotUpdate = new Models.Request.UpdateClient.UpdateClientRequest
                {
                    data = new List <Models.Request.UpdateClient.Datum>(),
                    _id  = HomeActivity.GetInstance().clientInfo._id,
                    _rev = HomeActivity.GetInstance().clientInfo._rev,
                };
                arrayListDataFotUpdate.data.Add(clientInfo);

                var response = ApiService.UpdateInfo(
                    Constants.Url.UpdateClientInfoServicePrefix,
                    arrayListDataFotUpdate).Result;

                if (!response.IsSuccess)
                {
                    RunOnUiThread(() =>
                    {
                        progressBar.Visibility                = ViewStates.Gone;
                        contentLinearLayout.Visibility        = ViewStates.Visible;
                        Android.App.AlertDialog.Builder dialo = new AlertDialog.Builder(this);
                        AlertDialog aler = dialo.Create();
                        aler.SetTitle("ALERTA");
                        aler.SetMessage("Hubo un error inesperado");
                        aler.SetButton("ACEPTAR", (c, ev) =>
                                       { });
                        aler.SetButton2("CANCEL", (c, ev) => { });
                        aler.Show();
                    });
                    return;
                }


                var Client = (Models.Responses.UpdateClient.UpdateClientResponse)response.Result;

                if (Client.data[0].header.status.Equals("200"))
                {
                    RunOnUiThread(() =>
                    {
                        progressBar.Visibility                  = Android.Views.ViewStates.Gone;
                        contentLinearLayout.Visibility          = Android.Views.ViewStates.Visible;
                        Android.App.AlertDialog.Builder dialogs = new AlertDialog.Builder(this);
                        AlertDialog alerts = dialogs.Create();
                        alerts.SetTitle("Operación Exitosa");
                        alerts.SetMessage("Su información ha sido actualizada");
                        alerts.SetButton("ACEPTAR", (c, ev) =>
                        {
                            var intent = new Intent(this, typeof(AccountsActivity));
                            StartActivity(intent);
                            Finish();
                        });
                        alerts.Show();
                    });
                    return;
                }

                RunOnUiThread(() =>
                {
                    progressBar.Visibility                 = Android.Views.ViewStates.Gone;
                    contentLinearLayout.Visibility         = Android.Views.ViewStates.Visible;
                    Android.App.AlertDialog.Builder dialog = new AlertDialog.Builder(this);
                    AlertDialog alert = dialog.Create();
                    alert.SetTitle("ALERTA");
                    alert.SetMessage("Hubo un error inesperado");
                    alert.SetButton("ACEPTAR", (c, ev) =>
                                    { });
                    alert.SetButton2("CANCEL", (c, ev) => { });
                    alert.Show();
                });
                return;
            });
        }