public static GetStartedUserInfoFragment NewInstance()
        {
            var fragment = new GetStartedUserInfoFragment {
                Arguments = new Bundle()
            };

            return(fragment);
        }
Esempio n. 2
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            base.OnCreateView(inflater, container, savedInstanceState);
            View view = inflater.Inflate(Resource.Layout.fragment_signup, null);

            ViewModel = new SignUpViewModel();


            logInGoCommand = view.FindViewById <TextView>(Resource.Id.login_prompt);
            email          = view.FindViewById <AutoCompleteTextView>(Resource.Id.txtEmail);
            userName       = view.FindViewById <AutoCompleteTextView>(Resource.Id.txtUserName);
            password       = view.FindViewById <TextInputEditText>(Resource.Id.txtPassword);
            signUpButton   = view.FindViewById <Button>(Resource.Id.btnConfirm);

            logInGoCommand.Click += (sender, e) =>
            {
                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, LoginFragment.NewInstance())
                .AddToBackStack(null).Commit();
            };

            signUpButton.Click += async(sender, e) =>
            {
                var user = new User
                {
                    Email    = email.Text,
                    Username = userName.Text,
                    Password = password.Text
                };

                await ViewModel.SignUp(user);

                if (ViewModel.CurrentUser == null)
                {
                    return;
                }

                FragmentManager.BeginTransaction().Replace(Resource.Id.content_frame, GetStartedUserInfoFragment.NewInstance())
                .AddToBackStack(null).Commit();
            };


            return(view);
        }