示例#1
0
        protected virtual void OnSpokenSentence(string Sentence)
        {
            SpokenSentence spoken = new SpokenSentence();

            spoken.Sentence = Sentence;
            OnSpokenSentenceEvent(spoken);
        }
示例#2
0
        protected virtual void OnSpokenSentenceEvent(SpokenSentence spokenSentence)
        {
            EventHandler <SpokenSentence> handler = SpokenSentenceEvent;

            if (handler != null)
            {
                handler(this, spokenSentence);
            }
        }
示例#3
0
        protected virtual void OnSAPISpeakingSentence(object sender, SpeakProgressEventArgs eventArgs)
        {
            IsSpeaking = true;

            int index = eventArgs.CharacterPosition + eventArgs.CharacterCount;

            if (index > 0)
            {
                index = index - 1;
            }

            if (index > SpeakingSentence.Length)
            {
                index = SpeakingSentence.Length;
            }

            string         SpokenString   = SpeakingSentence.Substring(0, index);
            SpokenSentence spokenSentence = new SpokenSentence();

            spokenSentence.Sentence = SpokenString;
            OnSpokenSentenceEvent(spokenSentence);
        }