Ejemplo n.º 1
0
 private void Login(object sender, RoutedEventArgs e)
 {
     if ((string.IsNullOrEmpty(logUsernameBox.Text) | (string.IsNullOrEmpty(logPasswordBox.Password))))
     {
         MessageBox.Show("Every field should be filled!", "Filling error", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
     if ((_logics.users
          .Any(value => value.Username.Equals(logUsernameBox.Text))) &&
         (_logics.users
          .Any(value => value.Password.Equals(logPasswordBox.Password))))
     {
         var levelEn = _logics.GetLevel(logUsernameBox.Text).Item1;
         var levelJa = _logics.GetLevel(logUsernameBox.Text).Item2;
         var levelEs = _logics.GetLevel(logUsernameBox.Text).Item3;
         var window  = new UsersPersonalWindow(logUsernameBox.Text, levelEn, levelJa, levelEs);
         window.ShowDialog();
         Close();
     }
     else
     {
         MessageBox.Show("Uncorrect username or/and password", "User not found", MessageBoxButton.OK, MessageBoxImage.Error);
         return;
     }
 }
Ejemplo n.º 2
0
 private void ThirdAnswer(object sender, RoutedEventArgs e)
 {
     if (correctAnswer == 3)
     {
         MessageBox.Show("Correct!", "Answer", MessageBoxButton.OK, MessageBoxImage.Information);
         _logics.LevelUp(_username, qname);
         var window = new UsersPersonalWindow(_username, _levelEn, _levelJa, _levelEs);
         window.ShowDialog();
         Close();
     }
     else
     {
         MessageBox.Show("Uncorrect! Try again", "Answer", MessageBoxButton.OK, MessageBoxImage.Information);
     }
 }