Exemplo n.º 1
0
        private async void CreateBtn_Click(object sender, RoutedEventArgs e)
        {
            bool correctInput = VerifyInput(FirstName.Text, MiddleName.Text, LastName.Text, Email.Text, Password.Text, RetypePassword.Text);
            bool correctEmail = VerifyEmail(Email.Text);
            CreateAccountData createAccount = new CreateAccountData {
                FirstName  = FirstName.Text,
                MiddleName = MiddleName.Text,
                LastName   = LastName.Text,
                Email      = Email.Text,
                Password   = Password.Text
            };

            if (correctEmail == true && correctInput == true)
            {
                sessionObj = await ServerProxySingleton.serverProxy.GetUnauthorizedSession();

                createAccount.SessionKey = sessionObj.Session;

                createAccountObj = await ServerProxySingleton.serverProxy.CreateAccount(createAccount);

                if (createAccountObj.CreateAccountResult.Equals("Success"))
                {
                    NavigationService.Navigate(new Home());
                }

                else
                {
                    MessageBox.Show("Registration fail");
                }
            }
        }
Exemplo n.º 2
0
        public async Task <CreateAccountResultType> CreateAccount(CreateAccountData data)
        {
            data.TimeZone = TimeZone.CurrentTimeZone.GetUtcOffset(DateTime.Today).Hours;
            HttpContent httpContent = new ByteArrayContent(data.GetMemoryStream().ToArray());
            var         content     = await httpClient.PostAsync(serverURL + "/CreateAccount", httpContent);

            return(CreateAccountResultType.ReadFromStream(await content.Content.ReadAsStreamAsync()));
        }