private void btn_subgen_Click(object sender, EventArgs e) { subtitle_handle.VideoFile = filename; if (radioButton_type0.Checked == true) { subtitle_handle.FpsType = fpstype.Type0; } if (radioButton_type1.Checked == true) { subtitle_handle.FpsType = fpstype.Type1; } makesub subdelegate = new makesub(generatesubtitles); IAsyncResult makereturn = subdelegate.BeginInvoke(null, null); //makereturn.AsyncWaitHandle.WaitOne(); //this blocks the thread until the asyncresult returms - be careful, //calls to UI thread (control.invoke) in other threads will lock up the program elapsedtime = 0; lb_elapsedtime.Text = elapsedtime.ToString(); timer1.Enabled = true; UseWaitCursor = true; btn_subgen.Enabled = false; btn_savesubs.Enabled = false; rtb_subcontent.Enabled = false; cb_timedisp.Enabled = false; }