示例#1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            SetContentView(Resource.Layout.SetupTwo);
            FindViewById <TextView> (Resource.Id.PasswordText).Enabled = false;
            FindViewById <TextView>(Resource.Id.NameText).Text         = DAO.getDetails(0);
            FindViewById <TextView>(Resource.Id.EmailText).Text        = DAO.getDetails(1);
            FindViewById <TextView>(Resource.Id.PasswordText).Text     = DAO.getDetails(2);

            var updateDetails = FindViewById <Button>(Resource.Id.updateAccountDetails);

            updateDetails.Click += (sender, e) => {
                if (FindViewById <TextView>(Resource.Id.NameText).Text.Count <Char>() > 1)
                {
                    if (FindViewById <TextView>(Resource.Id.EmailText).Text.Count <Char>() > 7)
                    {
                        if (FindViewById <TextView>(Resource.Id.EmailText).Text.Contains("@") && FindViewById <TextView>(Resource.Id.EmailText).Text.Contains("."))
                        {
                            if (FindViewById <TextView>(Resource.Id.NameText).Text == DAO.getDetails(0) && FindViewById <TextView>(Resource.Id.EmailText).Text == DAO.getDetails(1))
                            {
                                Toast.MakeText(this, "No Change Made!!", ToastLength.Short).Show();
                            }
                            else
                            {
                                DAO.updateUserDetails(FindViewById <TextView>(Resource.Id.NameText).Text,
                                                      FindViewById <TextView>(Resource.Id.EmailText).Text,
                                                      FindViewById <TextView>(Resource.Id.PasswordText).Text);

                                Toast.MakeText(this, "Account Details Saved!!", ToastLength.Short).Show();
                            }
                        }
                        else
                        {
                            Toast.MakeText(this, "Wrong Email Format!!", ToastLength.Short).Show();
                        }
                    }
                    else
                    {
                        Toast.MakeText(this, "Enter Email please!!", ToastLength.Short).Show();
                    }
                }
                else
                {
                    Toast.MakeText(this, "Enter Your Name Please!!", ToastLength.Short).Show();
                }
            };
        }