private async void BtnAdd_Click(object sender, RoutedEventArgs e) { UserApiService userService = new UserApiService(); try { lblErrorName.Foreground = Brushes.White; lblErrorPassword.Foreground = Brushes.White; lblErrorName.Content = ""; lblErrorPassword.Content = ""; string req = await userService.LoginAsync(new UserLoginVM { Name = txtName.Text, Password = txtPassword.Text }); MessageBox.Show("Ви успішно зареєструвались."); userName = txtName.Text; this.Close(); } catch (WebException wex) { ShowException(wex); } }