private void UserEntry_Completed(object sender, EventArgs e) { if (!string.IsNullOrEmpty(UserEntry.Text)) { Helpers.Settings.UserEmail = UserEntry.Text; PasswordEntry.Focus(); } else { //DependencyService.Get<IMessage>().LongAlert("User Email is blank!"); UserDialogs.Instance.ShowError("User Email is blank!", 3000); UserEntry.Focus(); } }
private async void LoginButton_Cliked(object sender, EventArgs e) { string name = UserEntry.Text; string password = PasswordEntry.Text; string uriString = "http://app.casterstats.com/login?user="******"&password="******"&rememberme=false"; HttpResponseMessage resp; using (var client = new HttpClient()) { var uri = new Uri(uriString); resp = await client.PostAsync(uri, null); } string logIdcookies = resp.Headers.GetValues("Set-Cookie").FirstOrDefault(x => x.Contains(".ASPXAUTH")); await BlobCache.LocalMachine.InsertObject("loginCookie", logIdcookies); var result = await resp.Content.ReadAsStringAsync(); var r = JsonConvert.DeserializeObject <LoginResponse>(result); if (r.Success) { await Navigation.PushModalAsync(new MenuPage()); } else { await DisplayAlert("Error", r.Msg, "Ok"); UserEntry.Focus(); PasswordEntry.Focus(); } }