Пример #1
0
        async private void RegisterClick(Object sender, EventArgs e)
        {
            if (RegEmailForm.Text == null || RegLoginForm.Text == null || RegPasswordForm.Text == null || RegNicknameForm.Text == null)
            {
                var toastmessage = "Need to fill everything";
                DependencyService.Get <ToastMessage>().ShortTime(toastmessage);
            }
            else
            {
                var accountApiServises = new AccountApiServises();
                var content            = await accountApiServises.RegisterUserAsync(RegEmailForm.Text, RegLoginForm.Text, RegPasswordForm.Text, RegNicknameForm.Text);

                if (content != null)
                {
                    CurrentUser.ThisUser = new CurrentUser(content);
                    OpenAuthorizedStackLayout();
                    await _viewModel.ExecuteLoadItemsCommand();

                    ClearRegForm();
                }
                else
                {
                    var toastmessage = "Failed to create";
                    DependencyService.Get <ToastMessage>().ShortTime(toastmessage);
                }
            }
        }
Пример #2
0
        async void RegisterClick(Object sender, EventArgs e)
        {
            if (EmailForm.Text == null || LoginForm.Text == null || PasswordForm.Text == null || NicknameForm.Text == null)
            {
                var toastmessage = "Need to fill everything";
                DependencyService.Get <ToastMessage>().ShortTime(toastmessage);
            }
            else
            {
                var accountApiServises = new AccountApiServises();
                var content            = await accountApiServises.RegisterUserAsync(EmailForm.Text, LoginForm.Text, PasswordForm.Text, NicknameForm.Text);

                if (content != null)
                {
                    new CurrentUser(content);
                    await Navigation.PushAsync(new RegisterSucces());
                }
                else
                {
                    var toastmessage = "Failed to create";
                    DependencyService.Get <ToastMessage>().ShortTime(toastmessage);
                }
            }
        }