Example #1
0
        //朗读选中文本
        private async void OnRead(string text)
        {
            if (text != "")
            {
                SpeechSynthesizer     synthesizer = new SpeechSynthesizer();
                SpeechSynthesisStream stream      = await synthesizer.SynthesizeTextToStreamAsync(text);

                //Me为MediaElement AutoPlay true;
                PronunciationPlayer.SetSource(stream, stream.ContentType);
            }
        }
Example #2
0
        private void GridView_ItemClick(object sender, ItemClickEventArgs e)
        {
            var item = e.ClickedItem as PronounciationViewModel;

            try
            {
                PronunciationPlayer.Source = new Uri(item.SoundUri);
                PronunciationPlayer.Play();
            }
            catch
            {
            }
        }