public bool Start(int message_box_length, ThreadP_Message.delegate_Procedure proc, object xparam, int timeOutInSec, ref string ErrReason) { try { m_ThreadP2Ctrl_MessageBox = new ThreadP2Ctrl_MessageBox(message_box_length); ThreadData thdata = new ThreadData(proc, xparam, timeOutInSec, m_ThreadP2Ctrl_MessageBox); message_box = new ThreadP_MessageBox(message_box_length); FVI_Thread = new System.Threading.Thread(Run); FVI_Thread.SetApartmentState(ApartmentState.STA); FVI_Thread.Start(thdata); return true; } catch (Exception ex) { ErrReason = ex.Message; return false; } }
public ThreadData(ThreadP_Message.delegate_Procedure procedure,object xParameterAsObject, int xtimeOutInSec, ThreadP2Ctrl_MessageBox x_ThreadP2Ctrl_MessageBox) { Procedure = procedure; ParameterAsObject = xParameterAsObject; timeOutInSec = xtimeOutInSec; m_ThreadP2Ctrl_MessageBox = x_ThreadP2Ctrl_MessageBox; }