protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); SetContentView(Resource.Layout.activity_userProfile); userName = FindViewById <EditText>(Resource.Id.displayName); userEmail = FindViewById <EditText>(Resource.Id.displayEmail); userPassword = FindViewById <EditText>(Resource.Id.displayPassword); userAge = FindViewById <EditText>(Resource.Id.displayAge); btn_Back = FindViewById <Button>(Resource.Id.btnBack); myDB = new DBHelperClass(this); myName = Intent.GetStringExtra("userName"); userData = myDB.getUserData(myName); userName.Text = userData[0]; userEmail.Text = userData[1]; userPassword.Text = userData[2]; userAge.Text = userData[3]; userName.Enabled = false; userEmail.Enabled = false; userPassword.Enabled = false; userAge.Enabled = false; btn_Back.Click += backToList; }
/*public void deleteBtnClicEvent(object sender, EventArgs e) * { * alert.SetTitle("Info"); * alert.SetMessage("Do you want to delete this account?"); * alert.SetPositiveButton("Yes", alertYesButton); * alert.SetNegativeButton("No", alertNoButton); * Dialog myDialog = alert.Create(); * myDialog.Show(); * }*/ public void alertSuccessOKButton(object sender, Android.Content.DialogClickEventArgs e) { Intent newScreen = new Intent(this, typeof(LogInActivity)); string[] userData = myDB.getUserData(email, password); newScreen.PutExtra("userName", userData[0]); newScreen.PutExtra("userEmail", userData[1]); newScreen.PutExtra("userPassword", userData[2]); newScreen.PutExtra("userAge", userData[3]); StartActivity(newScreen); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); // Set our view from the "main" layout resource SetContentView(Resource.Layout.activity_main); userName = FindViewById <EditText>(Resource.Id.myEmail); userPassword = FindViewById <EditText>(Resource.Id.myPassword); btn_logIn = FindViewById <Button>(Resource.Id.logIn_button1); btn_signUp = FindViewById <Button>(Resource.Id.signUp_Button); alert = new Android.App.AlertDialog.Builder(this); myDB = new DBHelperClass(this); btn_logIn.Click += delegate { var value1 = userName.Text; var value2 = userPassword.Text; System.Console.WriteLine("UserName: "******"Password: "******" ") || value1.Length < 0 || value2.Trim().Equals(" ") || value2.Length < 0) { alert.SetTitle("Error"); alert.SetMessage("Please Enter Valid Data"); alert.SetPositiveButton("OK", alertOKButton); alert.SetNegativeButton("Cancel", alertOKButton); Dialog myDialog = alert.Create(); myDialog.Show(); } else { if (myDB.checkUser(value1, value2)) { string[] userData = myDB.getUserData(value1, value2); Intent newScreen = new Intent(this, typeof(LogInActivity)); newScreen.PutExtra("userName", userData[0]); newScreen.PutExtra("userEmail", userData[1]); newScreen.PutExtra("userPassword", userData[2]); newScreen.PutExtra("userAge", userData[3]); StartActivity(newScreen); } else { alert.SetTitle("Error"); alert.SetMessage("Invalid Email id or Password"); alert.SetPositiveButton("OK", alertOKButton); Dialog myDialog = alert.Create(); myDialog.Show(); } } }; btn_signUp.Click += delegate { Intent signUpScreen = new Intent(this, typeof(SignupActivity)); StartActivity(signUpScreen); }; }