コード例 #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.activity_profile);

            userName     = FindViewById <EditText>(Resource.Id.displayName);
            userEmail    = FindViewById <EditText>(Resource.Id.displayEmail);
            userPassword = FindViewById <EditText>(Resource.Id.displayPassword);
            userAge      = FindViewById <EditText>(Resource.Id.displayAge);

            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;
        }
コード例 #2
0
ファイル: LogInActivity.cs プロジェクト: TominPaul/Explore365
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            SetContentView(Resource.Layout.activity_login);

            userName     = FindViewById <EditText>(Resource.Id.myEmail);
            userPassword = FindViewById <EditText>(Resource.Id.myPassword);
            btn_logIn    = FindViewById <Button>(Resource.Id.logIn_Button);
            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(BookingActivity));
                        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);
            };
        }