private void btnEnter_Click(object sender, RoutedEventArgs e) { string login = TbLogin.Text; string password = PbPassword.Password; Guid? result = MainWindow.ServerClient.Authorize(login, password); if (result == null) { MessageBox.Show("Неверный логин или пароль", "Ошибка", MessageBoxButton.OK, MessageBoxImage.Error); TbLogin.Clear(); PbPassword.Clear(); } else { _userId = (Guid) result; this.Hide(); var contatcs = new MainWindow(_userId, login); contatcs.Activate(); contatcs.Show(); this.Close(); } }