I am developing an window form application, in which i am playing an audio of wave format, and want to convert that pre recorded speech or audio into text format(using speech api) and display that text in the label. I started a thread for audio to text conversion in the play button, now i want to pause that thread on the pause button(means how to pause a that thread). I used ManualEventReset method. but in the pause button when i am using signal.waitone() methods. this freez the whole form. please help.some parts of my code is given here. //pause button
ManualResetEvent signal = new ManualResetEvent(false);
ManualResetEvent signal = new ManualResetEvent(false);
private void buttonX15_Click(object sender, EventArgs e)
{
method_pause();
}
public void method_pause()
{
clip.Pause();
visular1.Stop();
visular2.Stop();
visular3.Stop();
visular4.Stop();
visular5.Stop();
this.pause.Hide();
signal.WaitOne();
play.Show();
}
private void play_Click(object sender, EventArgs e)
{
playsub();
labelX1.Text = "Play";
}
public void playsub()
{
starter = delegate { subt(FName); };
thread=new Thread(starter);
try
{
thread.Start();
method\_play();
}
catch(Exception ex){}
}
from where i can set the thread.