private void mainBackgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            DataViewerActionArgs actionArgs = (DataViewerActionArgs)e.Argument;
            DataActionEventArgs  eventArgs  = new DataActionEventArgs(actionArgs.Data);

            switch (actionArgs.Action)
            {
            case DataViewerAction.Load:
                OnLoadAsync(eventArgs);
                break;

            case DataViewerAction.Open:
                OnOpenAsync(eventArgs);
                break;

            case DataViewerAction.New:
                OnNewAsync(eventArgs);
                break;

            case DataViewerAction.Delete:
                OnDeleteAsync(eventArgs);
                break;
            }

            DataViewerActionResult result = new DataViewerActionResult(
                eventArgs.Data,
                actionArgs.StatusGuid,
                eventArgs.Cancelled,
                eventArgs.UserMessage,
                actionArgs.Action);

            e.Result = result;
        }
        private void runActionAsync(DataViewerAction action, object inputData)
        {
            if (!mainBackgroundWorker.IsBusy)
            {
                DataActionBeforeEventArgs beforeArgs = new DataActionBeforeEventArgs(inputData);
                switch (action)
                {
                case DataViewerAction.Load:
                    OnBeforeLoadAsync(beforeArgs);
                    break;

                case DataViewerAction.Open:
                    OnBeforeOpenAsync(beforeArgs);
                    break;

                case DataViewerAction.New:
                    OnBeforeNewAsync(beforeArgs);
                    break;

                case DataViewerAction.Delete:
                    OnBeforeDeleteAsync(beforeArgs);
                    break;
                }

                if (!beforeArgs.Cancel)
                {
                    DataViewerActionArgs args = new DataViewerActionArgs(
                        beforeArgs.Data,
                        beforeArgs.StatusGuid,
                        action);

                    mainBackgroundWorker.RunWorkerAsync(args);
                }
                else
                {
                    DataViewerActionResult result = new DataViewerActionResult(
                        beforeArgs.Data,
                        beforeArgs.StatusGuid,
                        true,
                        string.Empty,
                        action);

                    handleAfterDataAction(result);
                }
            }
        }