예제 #1
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "gameplay" layout resource
            SetContentView(Resource.Layout.profile);

            // find our text fields
            usernameText = FindViewById<EditText>(Resource.Id.text_username);
            emailText = FindViewById<EditText>(Resource.Id.text_email);

            Button button_save_profile = FindViewById<Button>(Resource.Id.button_save_profile);
            button_save_profile.Click += delegate {
                // get the current User
                User user = Session.CurrentSession.User;

                // update his values
                user.Login = usernameText.Text;
                user.EmailAddress = emailText.Text;

                // set up a request observer
                ProfileRequestControllerObserver observer = new ProfileRequestControllerObserver(this);

                // with our observer, set up the request controller
                UserController userController = new  UserController(observer);

                // pass the user into the controller
                userController.SetUser(user);

                ShowDialog(DIALOG_PROGRESS);

                // submit our changes
                userController.SubmitUser();
            };
        }