예제 #1
0
        /* .NET 3.5 only */

        public static void ForEach <TSource>(IEnumerable <TSource> source, Action <TSource> body)
        {
            ParameterizedThreadStart threadStart = (object x) => body((TSource)x);
            var ts = new List <Original.Thread>();

            try
            {
                foreach (var s in source)
                {
                    var t = new Original.Thread(threadStart);
                    ts.Add(t);
                    t.Start(s);
                }
            }
            finally
            {
                foreach (var t in ts)
                {
                    try { }
                    finally
                    {
                        t.Join();
                    }
                }
            }
        }
 private void HandleContinuousSoundRecognized(object sender, global::AuxiliaryLibrary.StringEventArgs e)
 {
     if (!clientBusy)
     {
         clientBusy   = true;
         clientThread = new global::System.Threading.Thread(new global::System.Threading.ThreadStart(() => SendMessage(e.StringValue)));
         clientThread.Start();
     }
     //    client.Send(e.StringValue);
     if (continuousSpeechRecognitionControl.ExtractDetectedSounds == true)
     {
         if (InvokeRequired)
         {
             this.BeginInvoke(new global::System.Windows.Forms.MethodInvoker(() => ShowContinuousRecognizedSound(e.StringValue)));
         }
         else
         {
             ShowContinuousRecognizedSound(e.StringValue);
         }
     }
 }