private static void ShowThreadExceptionDialog(Exception exception) { using (var frm = new FrmException(exception, new CrashReportSender())) { var rsx = new System.ComponentModel.ComponentResourceManager(typeof(FrmMain)); frm.Icon = ((System.Drawing.Icon)(rsx.GetObject("$this.Icon"))); frm.ShowDialog(); } }
/// <summary> /// 处理异常信息 /// </summary> /// <param name="ex">异常</param> public void ProcessException(Exception ex) { // 201400711 页面假死问题解决 new Thread(() => { Thread.Sleep(500); this.Invoke((EventHandler) delegate { // 显示异常页面 var frmException = new FrmException(ex); frmException.ShowDialog(); }); }).Start(); }
private void ViewExceptionDetail() { if (dgvInfo.Rows.Count <= 0 || dgvInfo.CurrentCell == null) { return; } var exceptionEntity = new CiExceptionEntity { Message = dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldMessage].Value.ToString(), FormattedMessage = dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldFormattedMessage].Value.ToString(), CreateOn = BusinessLogic.ConvertToNullableDateTime(dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldCreateOn].Value), CreateBy = dgvInfo.CurrentRow.Cells[CiExceptionTable.FieldCreateBy].Value.ToString() }; var frmException = new FrmException(exceptionEntity); frmException.ShowDialog(); }
private void PopulateAllTabs() { Invoke(new Action(() => { try { SetUpExplorer(); SetUpSteam(); SetUpChrome(); SetUpWindowsStore(); } catch (Exception ex) { var frmException = new FrmException(ex); frmException.ShowDialog(); } })); }
public void Application_ThreadException(object sender, ThreadExceptionEventArgs e) { try { var frmException = new FrmException(e.Exception); frmException.ShowDialog(); } catch { try { MessageBox.Show("严重错误", "严重错误", MessageBoxButtons.OK, MessageBoxIcon.Stop); } finally { Application.Exit(); } } }
private void btnException2_Click(object sender, EventArgs e) { FrmException frmException = new FrmException(new Exception("自己创建的异常窗体")); frmException.ShowDialog(); }