Ejemplo n.º 1
0
        //авторизация
        private void Open_Login_Screen(object sender, RoutedEventArgs e)
        {
            UserAutorisation autorisationWindow = new UserAutorisation();

            if (autorisationWindow.ShowDialog() == true)
            {
                string Nickname = autorisationWindow.tbNickName.Text;
                string Password = autorisationWindow.tbPassword.Password;
                if (autorisationWindow.tbNickName.Text != "" && autorisationWindow.tbPassword.Password != "")
                {
                    bool result = client.Check_User(Nickname, Password);
                    if (result == false)
                    {
                        MessageBox.Show("User does not exist. Try another login or password",
                                        "Attention!", MessageBoxButton.OK, MessageBoxImage.Error);
                    }
                    else
                    {
                        tblockUserName.Text       = Nickname;
                        tblockUserName.Foreground = Brushes.Red;
                    }
                }
                else
                {
                    MessageBox.Show("Username and password fields can not be empty!",
                                    "Attention!", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }
        }