private void ProcessContext_BeforeMoveTo(WfMoveToEventArgs eventArgs) { OnBeforeMoveTo(this._DataContext, eventArgs); }
private void ProcessContext_AfterMoveTo(WfMoveToEventArgs eventArgs) { OnAfterMoveTo(this._DataContext, eventArgs); }
protected virtual void OnAfterMoveTo(WfExecutorDataContext dataContext, WfMoveToEventArgs eventArgs) { if (AfterMoveTo != null) AfterMoveTo(dataContext, eventArgs); }
protected virtual void OnBeforeMoveTo(WfExecutorDataContext dataContext, WfMoveToEventArgs eventArgs) { if (BeforeMoveTo != null) BeforeMoveTo(dataContext, eventArgs); }
internal void FireAfterMoveTo(WfMoveToEventArgs eventArgs) { if (this.AfterMoveTo != null) this.AfterMoveTo(eventArgs); }
internal void FireBeforeMoveTo(WfMoveToEventArgs eventArgs) { if (this.BeforeMoveTo != null) this.BeforeMoveTo(eventArgs); }
private IWfActivity InternalMoveTo(WfTransferParams transferParams) { WfProcessActionContext actionContext = WfRuntime.ProcessContext; WfProcessActionContextState state = actionContext.SaveDifferentProcessInfo(this); try { actionContext.ResetContextByProcess(this); WfActivityBase nextActivity = GetNextActivityFromTransferParams(transferParams); AdjustTransferParamsFromTemplates(nextActivity.Descriptor, transferParams); this.Status = WfProcessStatus.Running; nextActivity.StartTime = DateTime.Now; nextActivity.FromTransitionDescriptor = transferParams.FromTransitionDescriptor; //Set Original Activity Status if (this.CurrentActivity != null) { this.ApplicationRuntimeParameters["PreviousActivityID"] = this.CurrentActivity.ID; this.ApplicationRuntimeParameters["PreviousActivityName"] = GetActivityName(this.CurrentActivity); ((WfActivityBase)this.CurrentActivity).ToTransitionDescriptor = transferParams.FromTransitionDescriptor; ExecuteOriginalActivityActionsAndSetStatus(this.CurrentActivity, transferParams.Operator); } this.ApplicationRuntimeParameters["CurrentActivityID"] = nextActivity.ID; this.ApplicationRuntimeParameters["CurrentActivityName"] = GetActivityName(nextActivity); if (transferParams.FromTransitionDescriptor != null) this.ApplicationRuntimeParameters["CurrentTransitionName"] = GetTransitionName(transferParams.FromTransitionDescriptor); else this.ApplicationRuntimeParameters["CurrentTransitionName"] = string.Empty; WfMoveToEventArgs movetoEventArgs = new WfMoveToEventArgs(this.CurrentActivity, nextActivity, transferParams); actionContext.FireBeforeMoveTo(movetoEventArgs); //Set CurrentActivity to Next Activity this.CurrentActivity = nextActivity; actionContext.ResetContextByProcess(this); //是否进入到维护状态 if (IfIntoMaintainingStatus(nextActivity) == false) { //设置下一个节点的状态,包括启动分支流程、启动同类型的串行子流程 this.ExecuteNextActivityActionsAndSetStatus(nextActivity, transferParams); } //设置流程结束返回状态 if (transferParams.FromTransitionDescriptor != null) if (transferParams.FromTransitionDescriptor.AffectProcessReturnValue) this.Descriptor.DefaultReturnValue = transferParams.FromTransitionDescriptor.AffectedProcessReturnValue; this.ApplicationRuntimeParameters["CurrentProcessReturnValue"] = this.Descriptor.DefaultReturnValue; //自动生成每一个点候选人 if (this.Descriptor.AutoGenerateResourceUsers) this.GenerateCandidatesFromResources(); actionContext.FireAfterMoveTo(movetoEventArgs); WfRuntime.ProcessContext.AffectedProcesses.AddOrReplace(this); WfSimulator.WriteSimulationInfo(this, WfSimulationOperationType.MoveTo); actionContext.ResetContextByProcess(this); return nextActivity; } finally { actionContext.RestoreSavedProcessInfo(state); } }