/// <summary> /// Opens a modal dialog to execute the given delegate in a background worker /// </summary> /// <param name="message"></param> /// <param name="action"></param> /// <param name="onComplete"></param> /// <param name="bPreserveThreadCulture"></param> public static void Run(string message, BusyWaitDelegate action, Action <object, Exception> onComplete, bool bPreserveThreadCulture) { if (action == null) { throw new ArgumentNullException(nameof(action)); //NOXLATE } if (onComplete == null) { throw new ArgumentNullException(nameof(onComplete)); //NOXLATE } var frm = new BusyWaitDialog(action, bPreserveThreadCulture ? Thread.CurrentThread.CurrentCulture : null); frm.lblBusy.Text = message; if (frm.ShowDialog() == DialogResult.OK) { onComplete.Invoke(frm.ReturnValue, frm.Error); } }
/// <summary> /// Opens a modal dialog to execute the given delegate in a background worker /// </summary> /// <param name="message"></param> /// <param name="action"></param> /// <param name="onComplete"></param> /// <param name="bPreserveThreadCulture"></param> public static void Run(string message, BusyWaitDelegate action, Action<object, Exception> onComplete, bool bPreserveThreadCulture) { if (action == null) throw new ArgumentNullException("action"); //NOXLATE if (onComplete == null) throw new ArgumentNullException("onComplete"); //NOXLATE var frm = new BusyWaitDialog(action, bPreserveThreadCulture ? Thread.CurrentThread.CurrentCulture : null); frm.lblBusy.Text = message; if (frm.ShowDialog() == DialogResult.OK) { onComplete.Invoke(frm.ReturnValue, frm.Error); } }