Esempio n. 1
0
        public static void Speak(PromptBuilder p)
        {
            var synthesizer = CreateSynthesizerOutputToAudio();

            Prompt         spokenPrompt = synthesizer.SpeakAsync(p);
            SynthesisState state        = new SynthesisState(synthesizer, spokenPrompt);

            ShowSpeechCancelDialog(state);
        }
Esempio n. 2
0
        public static void Speak(PromptBuilder p)
        {
            var synthesizer = CreateSynthesizerOutputToAudio();

            Prompt spokenPrompt = synthesizer.SpeakAsync(p);
            SynthesisState state = new SynthesisState(synthesizer, spokenPrompt);
            
            ShowSpeechCancelDialog(state);
        }
Esempio n. 3
0
        private static void ShowSpeechCancelDialog(SynthesisState state)
        {
            SpeechSynthesizer synthesizer  = state.Synthesizer;
            Prompt            spokenPrompt = state.PromptBeingSynthesized;

            SpeechPlayingDialogBox speechPlayingDialog = new SpeechPlayingDialogBox(state);

            speechPlayingDialog.Closed += (sender, e) => SpeechPlayingDialog_Closed(synthesizer, spokenPrompt);
            speechPlayingDialog.ShowDialog();
        }
Esempio n. 4
0
        private static void ShowSpeechCancelDialog(SynthesisState state)
        {
            SpeechSynthesizer synthesizer = state.Synthesizer;
            Prompt spokenPrompt = state.PromptBeingSynthesized;

            SpeechPlayingForm progress = new SpeechPlayingForm(state);
            DialogResult result = progress.ShowDialog();
            if (result == DialogResult.Cancel)
            {
                try
                {
                    synthesizer.SpeakAsyncCancel(spokenPrompt);
                }
                catch (ObjectDisposedException)
                {
                    // Synthesizer has already finished, so we don't need to do anything.
                }
            }
        }
Esempio n. 5
0
        private static void ShowSpeechCancelDialog(SynthesisState state)
        {
            SpeechSynthesizer synthesizer  = state.Synthesizer;
            Prompt            spokenPrompt = state.PromptBeingSynthesized;

            SpeechPlayingForm progress = new SpeechPlayingForm(state);
            DialogResult      result   = progress.ShowDialog();

            if (result == DialogResult.Cancel)
            {
                try
                {
                    synthesizer.SpeakAsyncCancel(spokenPrompt);
                }
                catch (ObjectDisposedException)
                {
                    // Synthesizer has already finished, so we don't need to do anything.
                }
            }
        }
 public SpeechPlayingForm(SynthesisState state)
 {
     InitializeComponent();
     state.Synthesizer.SpeakCompleted += SynthesizerOnSpeakCompleted;
 }