Beispiel #1
0
        private async void LoginButtonClick(object sender, RoutedEventArgs e)
        {
            var command = new Command()
            {
                Student = new StudentViewModel()
                {
                    Login = loginTextBox.Text, Password = passwordTextBox.Password
                }, UserCommand = UserCommandServer.SignIn
            };

            _connectService.SendCommand(command);
            var inBoxCommand = (await _connectService.ReadCommand());

            if (inBoxCommand != null)
            {
                _connectService.Id = inBoxCommand.Id;
                if (inBoxCommand.IsSignIn)
                {
                    TestMainWindow testMainWindow = new TestMainWindow(_connectService, _testServices);
                    testMainWindow.Show();
                    Application.Current.MainWindow.Close();
                }
                else
                {
                    MessageBox.Show("Неверный логин или пароль");
                }
            }
            else
            {
                MessageBox.Show("Сервер не отвечает");
            }
        }