Example #1
0
        public void add(string gp, string goodcode, string cutsn)
        {
            //Console.WriteLine("队列++");
            string         content = string.Format(tempalte, gp, goodcode, cutsn);
            BorcastContent cont    = new BorcastContent();

            cont.Content = content;
            cont.Times   = 0;
            BorcastList.Enqueue(cont);
            done.Set();
        }
Example #2
0
 private void run()
 {
     if (BorcastList.Count > 0)
     {
         BorcastContent    borcast = BorcastList.Dequeue();
         SpeechSynthesizer reader  = new SpeechSynthesizer();
         reader.SpeakCompleted += new EventHandler <SpeakCompletedEventArgs>(reader_SpeakCompleted);
         reader.SpeakAsync(borcast.Content);
         borcast = null;
     }
     else
     {
         //Console.WriteLine("开始等待");
         BorcastList.Clear();
         done.Reset();
         done.WaitOne();//队列空在这等待
         run();
     }
 }