public static void OnThreadException(object sender, ThreadExceptionEventArgs e) { Debug.Assert(e != null); Debug.Assert(e.Exception != null); Debug.Assert(e.Exception.Message != null); Exception ex = e.Exception; if (Global.Instance.ExitSignal && ex is ObjectDisposedException) { return; } #if DEBUGGER Trace.WriteLine(ex, Strings.VRPINT); #endif new Action <Exception>((ee) => ServiceDataAccess.Instance.LogOperation(OperationHistory.Error, Program.SessionId, Program.currentUser.CountryID, 0, 0, 0, 0, ee.ToString())).FireAndForgetSafe(ex); Speeker.SpeakAsynchSf(ex.Message); #if !USE_LOGGER FileLogger.LogError(ex, Strings.VRPINT); #endif FileInfoApplicationException ex2 = e.Exception as FileInfoApplicationException; if (ex2 != null) { MainForm.Default.InvokeSf(() => { FileMsgForm.show(MainForm.Default, "Error", ex2.Message, ex2.Info); }); } else { MainForm.Default.InvokeSf(() => ex.ShowDialog(MainForm.Default)); } }
public static DialogResult show(IWin32Window owner, string caption, string message, FileInfo info = null, MessageBoxIcon icon = MessageBoxIcon.Error) { using (var dlg = new FileMsgForm()) { dlg.Caption = caption; dlg.Message = message; dlg.Info = info; dlg.IconType = icon; return(dlg.ShowDialog(owner)); } }
static void form_Load(object sender, EventArgs e) { FileMsgForm.show(sender as Form, "Test", "Test"); }