private void client_UploadValuesCompleted2(object sender, UploadValuesCompletedEventArgs e) { //lDialog.View.FindFocus(); //color to sign wrong wrote filed Color colorWrong = Color.ParseColor("#FFCDD2"); //red Color colorGood = Color.ParseColor("#ffffff"); //white Color colorAllGood = Color.ParseColor("#64FFDA"); //Green try { //login EditText mtxtusername = signInDialog.View.FindViewById <EditText>(Resource.Id.txtLogin); EditText mtxtpassword = signInDialog.View.FindViewById <EditText>(Resource.Id.txtPassowrd); RadioButton rbRememberMe = signInDialog.View.FindViewById <RadioButton>(Resource.Id.rb_rememberMe); string result = System.Text.Encoding.UTF8.GetString(e.Result); if (result.Contains("Wrong data") && mtxtpassword.Length() < 1) { //nie działa czemu ?:( Toast.MakeText(ApplicationContext, GetString(Resource.String.AllfieldsmustBefilledIn), ToastLength.Long).Show(); mtxtusername.SetBackgroundColor(colorWrong); mtxtpassword.SetBackgroundColor(colorWrong); } else if (result.Contains("Wrong data") && !(mtxtpassword.Length() > 1)) { Toast.MakeText(ApplicationContext, GetString(Resource.String.AllfieldsmustBefilledIn), ToastLength.Long).Show(); mtxtusername.SetBackgroundColor(colorWrong); mtxtpassword.SetBackgroundColor(colorWrong); } else { mtxtusername.SetBackgroundColor(colorGood); mtxtpassword.SetBackgroundColor(colorGood); } if (result.Contains("Success")) { Toast.MakeText(ApplicationContext, GetString(Resource.String.logInSuccess), ToastLength.Long).Show(); mtxtusername.SetBackgroundColor(colorAllGood); mtxtpassword.SetBackgroundColor(colorAllGood); mProgressBar.Visibility = Android.Views.ViewStates.Visible; LogInModule lg = new LogInModule(); lg.AddUserParams(mtxtusername.ToString(), mtxtpassword.ToString(), rbRememberMe.Checked); lg.saveLoginData(); //don't knwo why colors not set at #64FFDA after all good field Thread.Sleep(1000); signInDialog.Dismiss(); Thread thread = new Thread(logInSuccessProcess); thread.Start(); } } catch (Exception exc) { Console.WriteLine(exc.ToString()); } }
void singInDialog_mOnSingInComplete(object sender, OnSignInEvenArgs e) { EditText mtxtusername = signInDialog.View.FindViewById <EditText>(Resource.Id.txtLogin); EditText mtxtpassword = signInDialog.View.FindViewById <EditText>(Resource.Id.txtPassowrd); RadioButton rbRememberMe = signInDialog.View.FindViewById <RadioButton>(Resource.Id.rb_rememberMe); LogInModule lg = new LogInModule(); lg.AddUserParams(mtxtusername.Text.ToString(), mtxtpassword.Text.ToString(), rbRememberMe.Checked); //login string txtpasswd = mtxtpassword.Text; string txtname = mtxtusername.Text; // set color if someting wrong if (txtname.Count() < 1 && txtpasswd.Count() < 1) { mtxtusername.SetBackgroundColor(lg.colorWrong); mtxtpassword.SetBackgroundColor(lg.colorWrong); Toast.MakeText(ApplicationContext, GetString(Resource.String.AllfieldsmustBefilledIn), ToastLength.Long).Show(); } else if (txtname.Count() < 1) { mtxtusername.SetBackgroundColor(lg.colorWrong); mtxtpassword.SetBackgroundColor(lg.colorGood); Toast.MakeText(ApplicationContext, GetString(Resource.String.NeedLogin), ToastLength.Long).Show(); } else if (txtpasswd.Count() < 1) { mtxtpassword.SetBackgroundColor(lg.colorWrong); mtxtusername.SetBackgroundColor(lg.colorGood); Toast.MakeText(ApplicationContext, GetString(Resource.String.NeedPassword), ToastLength.Long).Show(); } else { mtxtusername.SetBackgroundColor(lg.colorGood); mtxtpassword.SetBackgroundColor(lg.colorGood); logiInRequest(txtname, txtpasswd); } }