コード例 #1
0
        public async void Register(string email, string password)
        {
            var loader  = new ResourceLoader();
            var newUser = new User()
            {
                Email = email, Password = password
            };
            var status = await _httpService.CreateAccount(newUser);

            switch (status)
            {
            case 204:
                _userDataStorageService.AddUserData("ASPassword", email, password);
                _httpService.SetAuthenticationHeader(email, password);
                _eventAggregator.PublishOnUIThread(new RegisterSuccessEvent()
                {
                    SuccessMessage = loader.GetString("RegisterSuccessMessage")
                });
                break;

            case 422:
                _eventAggregator.PublishOnUIThread(new RegisterFailedEvent()
                {
                    FailMessage = loader.GetString("RegisterEmailFailMessage")
                });
                break;

            default:
                _eventAggregator.PublishOnUIThread(new RegisterFailedEvent()
                {
                    FailMessage = loader.GetString("ServerError")
                });
                break;
            }
        }