コード例 #1
0
        public async void RegisterButton()
        {
            try
            {
                UserRegistrationModel urm = new UserRegistrationModel
                {
                    FirstName    = FirstName,
                    LastName     = LastName,
                    UserName     = UserName,
                    TCIDNumber   = TCIDNumber,
                    PhoneNumber  = PhoneNumber,
                    EmailAddress = EmailAddress,
                    Address      = Address,
                    Password     = Password
                };
                await _apiHelper.RegisterUser(urm);

                StatusMessage = ("Your account has been created. You are being redirected...");


                var tempAuthenticatedUser = await _apiHelper.Authenticate(urm.UserName, urm.Password);

                _loggedInUserModel.GetData(await _userEnd.GetLoggedInUserInfo(tempAuthenticatedUser.Access_Token));

                await _eventAggregator.PublishOnUIThreadAsync(new LogOnEvent());
            }

            catch (Exception ex)
            {
                StatusMessage = ex.Message;
            }
        }
コード例 #2
0
        public async void LoginButton()
        {
            try
            {
                _attemptingLogin = true;
                var result = await _apihelper.Authenticate(UserName, Password);

                StatusMessage = "Login successful! Redirecting to your account..";
                _loggedInUser.GetData(await _userEndPoint.GetLoggedInUserInfo(result.Access_Token));

                await _eventAggregator.PublishOnUIThreadAsync(new LogOnEvent());

                _attemptingLogin = false;
            }
            catch (Exception ex)
            {
                StatusMessage    = ex.Message;
                _attemptingLogin = false;
            }
        }