public DataEditorActionResult( object data, Guid statusGuid, bool cancelled, string userMessage, DataEditorAction action) : base(data, statusGuid, cancelled, userMessage) { this.Action = action; }
private void runActionAsync(DataEditorAction action, object data) { if (!mainBackgroundWorker.IsBusy) { suspendChangeMadeNotify = true; bool cancelMainEvents = false; if ((action == DataEditorAction.Save) || (action == DataEditorAction.SaveClose)) { // Only validate on save or save and close. cancelMainEvents = !RunValidateData(); } if (!cancelMainEvents) { runActionAsyncMainEvents(action, data); } } }
public DataEditorActionArgs(object data, Guid statusGuid, DataEditorAction action) : base(data, statusGuid) { this.Action = action; }
private void runActionAsyncMainEvents(DataEditorAction action, object data) { DataActionBeforeEventArgs beforeArgs = new DataActionBeforeEventArgs(data); switch (action) { case DataEditorAction.Load: { if (AutoChangeStatus) { beforeArgs.StatusGuid = AsyncStatusChange("Loading..."); } OnBeforeLoadAsync(beforeArgs); } break; case DataEditorAction.Save: case DataEditorAction.SaveClose: { if (AutoChangeStatus) { beforeArgs.StatusGuid = AsyncStatusChange("Saving..."); } OnBeforeSaveAsync(beforeArgs); switch (editorMode) { case DataEditorMode.Create: OnBeforeCreateAsync(beforeArgs); break; case DataEditorMode.Update: OnBeforeUpdateAsync(beforeArgs); break; } } break; } if (!beforeArgs.Cancel) { DataEditorActionArgs args = new DataEditorActionArgs( beforeArgs.Data, beforeArgs.StatusGuid, action); mainBackgroundWorker.RunWorkerAsync(args); } else { DataEditorActionResult result = new DataEditorActionResult( beforeArgs.Data, beforeArgs.StatusGuid, true, string.Empty, action); handleAfterDataAction(result); } }