LoginWindow.xaml.cs 735 B

1234567891011121314151617181920212223242526272829
  1. using System.Windows;
  2. using ComputerShopWpf.Services;
  3. namespace ComputerShopWpf.Views
  4. {
  5. public partial class LoginWindow : Window
  6. {
  7. public LoginWindow()
  8. {
  9. InitializeComponent();
  10. }
  11. private void LoginButton_Click(object sender, RoutedEventArgs e)
  12. {
  13. AuthService authService = new AuthService();
  14. string errorMessage;
  15. if (authService.Login(LoginTextBox.Text, UserPasswordBox.Password, out errorMessage))
  16. {
  17. MainWindow mainWindow = new MainWindow();
  18. mainWindow.Show();
  19. Close();
  20. return;
  21. }
  22. ErrorTextBlock.Text = errorMessage;
  23. }
  24. }
  25. }