AppStore.Templates.SpellingsPage.Listen_Click C# (CSharp) Method

Listen_Click() private method

Executed when the Listen button is tapped/pressed. It builds the Text-To-Speech api, which will spell the word.
private Listen_Click ( object sender, RoutedEventArgs e ) : void
sender object Object Sender is a parameter called Sender that contains a reference to the control/object that raised the event.
e Windows.UI.Xaml.RoutedEventArgs RoutedEventArgs e is a parameter called e that contains the event data, see the RoutedEventArgs MSDN page for more information.
return void
        private async void Listen_Click(object sender, RoutedEventArgs e)
        {
            using (var speech = new SpeechSynthesizer())
            {
                if ((bool)Female.IsChecked) speech.Voice = SpeechSynthesizer.AllVoices.First(i => i.Gender == VoiceGender.Female);
                else if ((bool)Male.IsChecked) speech.Voice = SpeechSynthesizer.AllVoices.First(i => i.Gender == VoiceGender.Male);
                var voiceStream = await speech.SynthesizeTextToStreamAsync(puzzle.getSpellingsList().ElementAt(puzzle.getActiveCount()).getWord());
                player.SetSource(voiceStream, voiceStream.ContentType);
                player.Play();
            }
            Next.IsEnabled = true; Spell.IsEnabled = true;
        }
    }