locked
Thread.Sleep() method call in dll used by WPF desktop app? RRS feed

  • Question

  • Hi All,

    I have a list of audio clips (.wav files) which need to play and hault for 5 secs for each clip. for this i used Thread.Sleep() in a method call. this code is in a class lib(.dll) which in turn used by a wpf desktop app. The same dll also contains code for speech recognition which starts with the launch of desktop app.

    I observe that when  a clip is played and thread is haulted, the speech recognition also doesn't work. sometimes the entire desktop app hangs. (in the hault time speech recognition and should continue to work and app should be responsive.)

    Please point to any resources for this kind of multithreading in dll. also any code help is appreciated. Part of inner method call is displayed below.

    public void play()
    {
    		 foreach (var testCase in testPlan.TestCase) 
            {
                Common.Common.flagListen = false;
    			tcManager.PlayTestAudioClipByTestCaseId(testCase.id);
                Common.Common.flagListen = true;
    			try 
                {
                    //Wait for delay time in 5secs                 Thread.Sleep(testCase.waittime*1000);
    			} 
                catch (Exception ex) 
                {
                    Common.Common.WriteToLog(ex.Message);
    			}
    		}
    }

    Thanks,

    bharat.

    Friday, December 7, 2012 2:11 PM

All replies

  • do you have a sample for your issue?

    Stay hungry, stay foolish

    Wednesday, December 12, 2012 7:58 AM