I have this code but its gets me an error in whichever Resource.id….
/Login Customize dialog
dialog = new Dialog(this);
dialog.SetContentView(Resource.Layout.login);
dialog.SetTitle("Sign in to CdcSoftware App");
dialog.SetCancelable(true);
//Ok
Button btnLogin = FindViewById<Button>(Resource.Id.btnLoginOK);
EditText txtUserName = FindViewById<EditText>(Resource.Id.txtUser);
TextView txtPassword = FindViewById<TextView>(Resource.Id.txtPassword);
//Cancel
Button btnCancel = FindViewById<Button>(Resource.Id.btnLoginCancel);
dialog.Show();
btnLogin.Click += delegate {Login(txtUserName, txtPassword);};
btnCancel.Click += delegate {Cancel();};
private void Login(EditText txtUserName, TextView txtPassword){
Intent intent = Intent;
string user = intent.GetStringExtra(txtUserName.ToString());
string password = intent.GetStringExtra(txtPassword.ToString());
var userObject = customers.FirstOrDefault(c => c.CustomerNumber.ToString() == user);
if (userObject != null)
{
Toast.MakeText(this, "User Id doesnt exist", ToastLength.Short).Show();
}
if(userObject.CustomerNumber.ToString().ToLower() == user && userObject.CustomerName.ToString().ToLower() == password)
{
Toast.MakeText(this, "Log in Successfully", ToastLength.Short).Show();
}
else
{
Toast.MakeText(this, "User Id or Password is Incorrect", ToastLength.Short).Show();
}
}
How can i fix it, and how to interact this custom dialog widgets with the main class.
My guess is you want:
instead of: