Ejemplo n.º 1
0
        // Shows the given input length, coloring each letter green (correct) or red (incorrect).
        private void SetAnalyzedNameTextBox(String input)
        {
            Animal currentAnimal = animalSpelling.GetCurrentAnimal();

            analyzedNameTextBlock.Inlines.Clear();
            if (currentAnimal == null)
            {
                return;
            }

            UpdatePrompt();

            VerifiedLetterCollection collection = animalSpelling.VerifyInput(input, currentAnimal.getAnimalName());

            foreach (VerifiedLetter letter in collection.letters)
            {
                Media.Color color;
                if (letter.isCorrect)
                {
                    color = Colors.Green;
                }
                else
                {
                    color = Colors.Red;
                }

                analyzedNameTextBlock.Inlines.Add(animalSpelling.CreateRun(letter.letter, color));
            }
        }
Ejemplo n.º 2
0
        // Displays the current animal, if there is no animal left
        // shows the results page
        private void DisplayCurrentAnimal()
        {
            Animal currentAnimal = animalSpelling.GetCurrentAnimal();

            imageBox.Source            = new BitmapImage(currentAnimal.getAnimalImage());
            userInputTextBox.MaxLength = currentAnimal.getAnimalName().Length;
            userInputTextBox.Text      = String.Empty;
            analyzedNameTextBlock.Text = String.Empty;
            SetAnalyzedNameTextBox("");

            UpdatePrompt();
        }
Ejemplo n.º 3
0
 // Returns the animal name
 public String getName()
 {
     return(animal.getAnimalName());
 }