Ejemplo n.º 1
0
 public static void ShowWindow(string message, IWin32Window owner = null)
 {
     if (_presentedDialog == null || _presentedDialog.IsDisposed)
     {
         _presentedDialog = new frmLoadingDialog();
     }
     _message = message;
     _cancel  = false;
     _presentedDialog.SetUp(false);
     if (owner == null)
     {
         _presentedDialog.Show();
     }
     else
     {
         _presentedDialog.ShowDialog(owner);
     }
 }
Ejemplo n.º 2
0
        public static object ShowWindow(Func <object, object> method, object param, string message, bool showProgress, IWin32Window owner = null)
        {
            if (_is_busy)
            {
                return(null);
            }

            if (_presentedDialog == null || _presentedDialog.IsDisposed)
            {
                _presentedDialog = new frmLoadingDialog();
            }

            _is_busy = true;
            _current_execution_return_detail = null;
            var t = new Thread(delegate(object o)
            {
                _current_execution_return_detail = method(o);
                _is_busy = false;
                try
                {
                    HideWindow();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                }
            });

            _message = message;
            _cancel  = false;
            _presentedDialog.SetUp(showProgress);
            t.Start(param);
            if (_is_busy)
            {
                _presentedDialog.Hide();
                _presentedDialog.ShowDialog(owner);
            }
            return(_current_execution_return_detail);
        }