Exemplo n.º 1
0
        //validates the user info
        private async void login()
        {
            var fname = FindViewById<EditText>(Resource.Id.editText1);
            var lname = FindViewById<EditText>(Resource.Id.editText2);
            var email = FindViewById<EditText>(Resource.Id.editText3);
            var pass = FindViewById<EditText>(Resource.Id.editText4);
            var errMsg = FindViewById<TextView>(Resource.Id.textView1);
            if (fname.Text!="" && lname.Text!="" && email.Text!="" && pass.Text!="")
            {
                errMsg.SetTextColor(Android.Graphics.Color.Green);
                client = new User();
                client.first_name = fname.Text;
                client.last_name = lname.Text;
                client.email = email.Text;
                client.password = pass.Text;
                client.latitude = 43.1656;
                client.longitude = -77.6114;
                MapActivity.client = client;

                //setting the global static client object
                errMsg.Text = await ApiRequests.createAccount(client) + ". logging in...";

                //startin map activity
                StartActivity(typeof(MapActivity));
            }
            else
            {
                errMsg.SetTextColor(Android.Graphics.Color.Red);
                errMsg.Text = "Please fill all the fields.";
            }
        }
Exemplo n.º 2
0
 public static async Task<string> getLocations(User user)
 {
     using (var client = new HttpClient())
     {
         client.BaseAddress = new Uri("http://www.cs.rit.edu/~jsb/2145/ProgSkills/Labs/Messenger/api.php");
         client.DefaultRequestHeaders.Accept.Clear();
         client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));
         HttpResponseMessage response = await client.GetAsync(
            "?command=getLocations&email=" + user.email +
            "&password="******"error";
         }
     }
 }