async private void registrarButton_Clicked(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(nombreEntry.Text) && !String.IsNullOrEmpty(apellido1Entry.Text) && !String.IsNullOrEmpty(apellido2Entry.Text) &&
                !String.IsNullOrEmpty(tipo.SelectedItem.ToString()) && !String.IsNullOrEmpty(correoEntry.Text) && !String.IsNullOrEmpty(passEntry.Text))
            {
                var client = new HttpClient
                {
                    BaseAddress = new Uri("https://app-produ.herokuapp.com")
                };
                var idType = userTypes.FirstOrDefault(x => x.Value == tipo.SelectedItem.ToString()).Key;

                var newUser = new User
                {
                    nombre      = nombreEntry.Text,
                    apellido1   = apellido1Entry.Text,
                    apellido2   = apellido2Entry.Text,
                    position_id = idType,
                    correo      = correoEntry.Text,
                    password    = passEntry.Text
                };

                string jsonData = JsonConvert.SerializeObject(newUser);
                var    content  = new StringContent(jsonData, Encoding.UTF8, "application/json");
                HttpResponseMessage response = await client.PostAsync("/users/signup.json", content);

                if (response.StatusCode == HttpStatusCode.Created)
                {
                    var result = await response.Content.ReadAsStringAsync();

                    var jobject = JObject.Parse(result);
                    var data    = JsonConvert.DeserializeObject <User>(jobject["usuario"].ToString());

                    try
                    {
                        Application.Current.Properties["id"]           = data.id;
                        Application.Current.Properties["currentToken"] = data.token;
                        await DisplayAlert("El usuario ha sido creado con éxito!", "Se desplegará a la pantalla de proyectos del usuario!", "OK");

                        var proyectosPage = new Proyectos();
                        await Navigation.PushAsync(proyectosPage);
                    }
                    catch (Exception)
                    {
                    }
                }
                else
                {
                    await DisplayAlert("Error!", "Correo ya está registrado!\nPor favor utilice otro!", "OK");
                }
            }
            else
            {
                await DisplayAlert("Error!", "Espacios vacíos!\nPor favor rellenar todos los espacios!", "OK");
            }
        }
 protected override async void OnAppearing()
 {
     try
     {
         int idUserLogged = (int)Application.Current.Properties["id"];
         if (idUserLogged != 0)
         {
             var proyectosPage = new Proyectos();
             await Navigation.PushAsync(proyectosPage);
         }
     }
     catch (Exception e)
     {
     }
 }
        async private void ingresarButton_Clicked(object sender, EventArgs e)
        {
            if (!String.IsNullOrEmpty(correoEntry.Text) && !String.IsNullOrEmpty(passEntry.Text))
            {
                userLogged.correo   = correoEntry.Text;
                userLogged.password = passEntry.Text;
                userLogged.correo   = userLogged.correo.Trim();
                var client = new HttpClient
                {
                    BaseAddress = new Uri("https://app-produ.herokuapp.com")
                };

                string jsonData = JsonConvert.SerializeObject(userLogged);
                var    content  = new StringContent(jsonData, Encoding.UTF8, "application/json");


                try
                {
                    HttpResponseMessage response = await client.PostAsync("/users/login.json", content);

                    if (response.StatusCode == HttpStatusCode.OK)
                    {
                        var result = await response.Content.ReadAsStringAsync();

                        var jobject = JObject.Parse(result);
                        var data    = JsonConvert.DeserializeObject <List <User> >(jobject["usuario"].ToString());
                        Application.Current.Properties["id"]           = data[0].id;
                        Application.Current.Properties["currentToken"] = data[0].token;
                        var proyectosPage = new Proyectos();
                        await Navigation.PushAsync(proyectosPage);
                    }
                    else
                    {
                        await DisplayAlert("Error!", "Usuario o contraseña inválidos!", "OK");
                    }
                }
                catch (Exception)
                {
                    await DisplayAlert("Error!", "Usuario o contraseña inválidos!", "OK");
                }
            }
            else
            {
                await DisplayAlert("Error!", "Espacios vacíos!\nPor favor rellenar todos los espacios!", "OK");
            }
        }