Ejemplo n.º 1
0
 AutoClosingMessageBox(string caption, int timeout, Func <string, MessageBoxButtons, DialogResult> showMethod,
                       MessageBoxButtons buttons = MessageBoxButtons.OK, DialogResult defaultResult = DialogResult.None)
 {
     this.caption = caption ?? string.Empty;
     this.result  = buttons.ToDialogResult(defaultResult);
     using (new Threading.Timer(OnTimerElapsed, result.ToDialogButtonId(buttons), timeout, Timeout.Infinite))
         this.result = showMethod(this.caption, buttons);
 }