public void KJThread() { try { f = new Func(); 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); string currentDT = f.GetCurrentDT(); if (currentDT != "京师") { throw new Exception("当前不在京师"); } f.KJ(); f.UnBindDM(); this.Invoke(DelegateSetControl, new object[] { gbSetting, true }); this.Invoke(DelegateSetControl, new object[] { gbStart, true }); return; } catch (Exception ex) { this.Invoke(delegateShowMsg, new object[] { ex.Message }); if (f != null) { f.UnBindDM(); this.Invoke(DelegateSetControl, new object[] { gbSetting, true }); this.Invoke(DelegateSetControl, new object[] { gbStart, true }); } } }