private void LoadAnswers(JapaneseWord word) { // Get random only 3 radio, the fourth is answer for (int i = 0; i < RADIOBUTTONS - 1; i++) { GetRandomRadio().First().Text = GetRandomWord().First(text => Text.Length > 1); } bool isAlreadyHaveAnswerInRadio = false; foreach (var radioButton in _radioGroup) { if (radioButton.Text == word.Japanese) { isAlreadyHaveAnswerInRadio = true; } } if (isAlreadyHaveAnswerInRadio) { GetRandomRadio().First().Text = GetRandomWord().First(text => Text.Length > 1); } else { GetRandomRadio().First().Text = word.Japanese; } }
private void LoadComponent(JapaneseWord word) { lblVietnamese.Text = word.Vietnamese; var imageResults = _client.Images.SearchAsync(query: word.Vietnamese).Result; pbbImage.ImageLocation = imageResults.Value[_random.Next(5)].ThumbnailUrl; }