예제 #1
0
        private void PrepareSoundsButtons()
        {
            int exerciseSetupId = _exerciseService.GetExerciseSetupIdByExerciseNumber(_exerciseNumber);
            var words           = _wordService.GetExerciseWordsByExerciseSetupId(exerciseSetupId);

            if (words != null)
            {
                int counter = 1;
                foreach (var word in words.OrderBy(a => Guid.NewGuid()).ToList()) //OrderBy used to randomized collection
                {
                    Button wordSoundButton = new Button
                    {
                        Tag = word.word_text
                    };
                    wordSoundButton.Content = "Słowo " + counter;
                    wordSoundButton.CustomizeAsSoundButton();
                    wordSoundButton.Click += new RoutedEventHandler(WordSoundButton_Click);

                    this.wordsSoundButtonsStackPanel.Children.Add(wordSoundButton);

                    counter++;
                }

                _wordsToGuessCount = words.Count;
            }
        }