public static void Start(Action action)
    {
        ASynch.RaiseOnModalAsyncStart();

        if (ASynch.IsEnabled)
        {
            var form = new AsyncForm(() =>
            {
                action();
                return(null);
            });
            form.ShowDialog();

            ASynch.RaiseOnModalAsyncEnd();

            if (form._error != null)
            {
                throw new ASyncException(form._error);
            }
        }
        else
        {
            try
            {
                action();
            }
            finally
            {
                ASynch.RaiseOnModalAsyncEnd();
            }
        }
    }
    public static T Start <T>(Func <T> action)
    {
        ASynch.RaiseOnModalAsyncStart();

        if (ASynch.IsEnabled)
        {
            var form = new AsyncForm(() => action());
            form.ShowDialog();

            ASynch.RaiseOnModalAsyncEnd();

            if (form._error != null)
            {
                throw new ASyncException(form._error);
            }

            return((T)form._result);
        }
        else
        {
            object res = null;
            try
            {
                res = action();

                ASynch.RaiseOnModalAsyncEnd();
            }
            catch
            {
                ASynch.RaiseOnModalAsyncEnd();

                throw;
            }

            return((T)res);
        }
    }