Example #1
0
 private void CleanUi()
 {
     Vm.ResetCommand.Execute(null);
     // Force delete transition
     WidgetZone.Children.Clear();
     InfoUnknownPanel.Opacity = 0;
     Img.Source = null;
     MediaElementCtrl.Stop();
 }
Example #2
0
        /// <summary>
        /// Make the voice speak the text
        /// When the voice has ended, start listening
        /// </summary>
        /// <param name="text">Text to be spoken</param>
        /// <returns>nothing</returns>
        private async Task Speak(string text)
        {
            await dispatcher.RunAsync(CoreDispatcherPriority.Normal, async() =>
            {
                AnimateCortana.Begin();

                CortanaSpeakTxt.Text = text;

                var stream = await _speechSynthesizer.SynthesizeTextToStreamAsync(text);
                MediaElementCtrl.SetSource(stream, stream.ContentType);
                MediaElementCtrl.Play();
            });
        }
Example #3
0
        private void VmOnPropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == nameof(Vm.IsConfiguring))
            {
                if (Vm.IsConfiguring)
                {
                    ShowGridLines(Vm.IsConfiguring);
                }
            }

            if (e.PropertyName == nameof(Vm.SpeakStream))
            {
                if (Vm.SpeakStream != null)
                {
                    MediaElementCtrl.SetSource((IRandomAccessStream)Vm.SpeakStream, ((SpeechSynthesisStream)Vm.SpeakStream).ContentType);
                    MediaElementCtrl.Play();
                }
            }
        }