Exemplo n.º 1
0
 private void Read()
 {
     if (ssz == null)
     {
         ssz = new System.Speech.Synthesis.SpeechSynthesizer();
         ssz.SpeakCompleted += (sender, e) =>
         {
             if (rindex + 1 < BookInfo.Sentenses.Length)
             {
                 rindex++;
                 ssz.SpeakAsync(BookInfo.Sentenses[rindex]);
             }
             else
             {
                 ssz.Pause();
             }
         };
         ssz.Volume = 100;
     }
     if (ssz.State == System.Speech.Synthesis.SynthesizerState.Paused)
     {
         ssz.Resume();
         return;
     }
     if (ssz.State == System.Speech.Synthesis.SynthesizerState.Speaking)
     {
         return;
     }
     if (BookInfo.Sentenses != null && BookInfo.Sentenses.Length > 0)
     {
         ssz.SpeakAsync(BookInfo.Sentenses[rindex]);
     }
 }