protected virtual void OnPrepareCommandState(IWfProcess process) { if (PrepareCommandState != null) { PerformanceMonitorHelper.GetDefaultMonitor().WriteExecutionDuration("PrepareCommandState", () => { CommandStateBase state = PrepareCommandState(process); if (state != null) { CommandStateHelper.RegisterState(state); } }); } }
private void OnProcessReadyHandler(IWfProcess process) { if (process.LoadingType == DataLoadingType.Cloned) { string sourceResourceID = WebUtility.GetRequestQueryString("sourceResourceID", string.Empty); ICommandStatePersist originalState = LoadStateByResourceID(sourceResourceID); ExceptionHelper.FalseThrow(originalState != null, "CopyForm时,必须实现LoadStateByResourceID方法"); ICommandStatePersist persistedState = (ICommandStatePersist)originalState; CommandStateBase newState = (CommandStateBase)persistedState.CloneBusinessObject(); CommandStateHelper.RegisterState(newState); } }