Esempio n. 1
0
        public static SignUpFragment NewInstance()
        {
            var fragment = new SignUpFragment {
                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_login, null);

            ViewModel = new LoginViewModel();

            registerGoCommand   = view.FindViewById <TextView>(Resource.Id.register_prompt);
            forgotPassGoCommand = view.FindViewById <TextView>(Resource.Id.forgot_password);
            userName            = view.FindViewById <AutoCompleteTextView>(Resource.Id.txtUserName);
            password            = view.FindViewById <TextInputEditText>(Resource.Id.txtPassword);
            loginButton         = view.FindViewById <Button>(Resource.Id.btnConfirm);

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

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

                await ViewModel.Login(user);

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

                var intent = new Intent(Activity, typeof(BasicMainActivity));
                intent.AddFlags(ActivityFlags.ClearTop);
                intent.AddFlags(ActivityFlags.ClearTask);
                StartActivity(intent);
                Activity.Finish();
            };

            return(view);
        }