public void DoWork(object obj) { try { ThreadParam p = (ThreadParam)obj; string toPath = p.toPath; string xlPath = p.xlPath; string xlNpcPath = p.xlNpcPath; int sdIndex = p.sdIndex; f = new Func(); f.FuncEventHandler += new EventHandler(f_FuncEventHandler); f.SetDMPath(PicPath); Thread.Sleep(500); int pid = 0, handle = 0; if (this.txtPID.Text.Trim() != "") { pid = int.Parse(txtPID.Text.Trim()); } if (this.txtHandle.Text.Trim() != "") { handle = int.Parse(txtHandle.Text.Trim()); } f.BindDM(ClassName, pid, handle); Thread.Sleep(1000); this.Invoke(DelegateSetControl, new object[] { gbSetting, false }); this.Invoke(DelegateSetControl, new object[] { gbStart, false }); if (cbZLDW.Checked == false) { for (int i = 0; i < 30; i++) { f.DoZhuanliMission(toPath, xlPath, xlNpcPath, sdIndex); //f.ZhuanliMission(); Thread.Sleep(10000); } } else { for (int i = 0; i < 20; i++) { f.DoZhuanliMissionEx(); Thread.Sleep(2000); } } } catch (Exception ex) { this.Invoke(delegateShowMsg, new object[] { ex.Message }); } }