public void ShowReportWindow(string message, bool isError, int timeLimitMS = 0) { if (isError) { Globals.Root.Log.WriteLine(message); } m_frmReport = frmUserReport.Display(message, this, timeLimitMS, () => { // called when form is closed for any reason m_frmReport = null; }); }
/// <summary>Displays the message, and calls the callback when the window is closed for any reason</summary> public static frmUserReport Display(string message, Control owner, int timeLimit = 0, Action whenClosed = null) { var frm = new frmUserReport() { m_WhenClosed = whenClosed }; frm.lblMessage.Text = message; if (timeLimit <= 0) { frm.m_EndTime = DateTime.Now.AddYears(1); } else { frm.m_EndTime = DateTime.Now.AddMilliseconds(timeLimit); frm.tmrAutoClose.Enabled = true; } frm.Show(owner); return(frm); }