void GetIt() { CheckForIllegalCrossThreadCalls = false; try { if (GetInsuranceSeq()) { printHandle.Print(this); } } catch (System.Drawing.Printing.InvalidPrinterException e) { this.BeginInvoke(new MethodInvoker(delegate() { MessageBox.Show("无法连接打印机!" + System.Environment.NewLine + System.Environment.NewLine + "请用记事本、Word等办公软件测试打印机是否正常工作。", "本地提示", MessageBoxButtons.OK, MessageBoxIcon.Information); })); EagleString.EagleFileIO.LogWrite(e.ToString()); } //catch (System.Net.WebException e1) //{ //} catch (Exception e2) { this.BeginInvoke(new MethodInvoker(delegate() { MessageBox.Show("出单异常,请查询出单记录。" + System.Environment.NewLine + System.Environment.NewLine + "若已出单可进行补打;若未出单请稍后重新尝试。", "本地提示", MessageBoxButtons.OK, MessageBoxIcon.Information); })); EagleString.EagleFileIO.LogWrite(e2.ToString()); } this.Invoke(new MethodInvoker(delegate() { pbPrint.Visible = false; btnPrint.Enabled = true; })); }
public void Print() { printHandle.Print(this); }