private void Button_Click(object sender, RoutedEventArgs e) { try { try { if (loginTextBox.Text.Length == 0) { throw new ArgumentException("Логин не может быть пустым."); } else if (!this.userService.IsUserExists(loginTextBox.Text)) { throw new ArgumentException("Пользователь с таким логином не существует."); } } catch (IndexOutOfRangeException) { } UserValidation.LoginValidation(loginTextBox.Text, passwordTextBox.Text); } catch (Exception ex) { MessageBox.Show(ex.Message); return; } try { string statusString = this.userService.AuthorizationUser(loginTextBox.Text, passwordTextBox.Text); if (statusString == "Blocked") { MessageBox.Show("Пользователь заблокирован."); return; } else if (statusString == "Deleted") { MessageBox.Show("Пользователь заблокирован."); return; } } catch (Exception ex) { MessageBox.Show("Неверный пароль."); return; } loginTextBox.Text = string.Empty; passwordTextBox.Text = string.Empty; this.Hide(); LoginedWindows loginedWindows = new LoginedWindows(this.userService, this); loginedWindows.Show(); }