Esempio n. 1
0
        public static WfProcessBuilderInfo GetBuilderInfo(string processKey)
        {
            processKey.CheckStringIsNullOrEmpty("processKey");

            WfProcessBuilderInfo builderInfo = null;

            DefaultProcessBuilderInfo.TryGetValue(processKey, out builderInfo);

            return(builderInfo);
        }
        public IWfProcessDescriptor GetBranchProcessDescriptor()
        {
            IWfProcessDescriptor result = this.PredefinedProcessDescriptor;

            if (result == null)
            {
                if (this.BranchProcessKey.IsNotEmpty())
                {
                    result = WfProcessDescriptorManager.GetDescriptor(this.BranchProcessKey);
                }
                else
                {
                    this.Key.CheckStringIsNullOrEmpty <WfRuntimeException>("加载分支子流程时,Template的BranchProcessKey不能和Key不能为空");
                    result = WfProcessDescriptorManager.GetDescriptor(this.Key);
                }

                if (this.ExecuteSequence == WfBranchProcessExecuteSequence.SerialInSameProcess)
                {
                    //Activity Matrix
                    WfProcessBuilderInfo builderInfo = WfProcessDescriptorManager.GetBuilderInfo(this.BranchProcessKey);

                    PropertyDefineCollection definedProperties = null;

                    if (builderInfo == null)
                    {
                        definedProperties = new PropertyDefineCollection();
                    }
                    else
                    {
                        definedProperties = builderInfo.Builder.GetDefinedProperties();
                    }

                    //生成活动
                    result.CreateActivities(this.Resources.ToCreateActivityParams(definedProperties), true);
                }

                AutoAdjustAgreeTransitions(result);

                //todo:ydz 2012-07-21
                this.SetBranchProcessActivityEditMode(result);
                //todo:ydz 2012-07-21
                this.CancelSubProcessNotifier.ForEach(wfr =>
                {
                    result.CancelEventReceivers.Add(wfr);
                });
            }

            return(result);
        }
Esempio n. 3
0
        private static IWfProcessDescriptor GetDefaultProcessDescriptor(string processKey)
        {
            string appName  = "DefaultApplication";
            string progName = "DefaultProgram";

            WfProcessBuilderInfo builderInfo = GetBuilderInfo(processKey);

            IWfProcessDescriptor processDesp = null;

            if (builderInfo != null)
            {
                if (WfRuntime.ProcessContext.OriginalActivity != null)
                {
                    appName  = WfRuntime.ProcessContext.OriginalActivity.Process.Descriptor.ApplicationName;
                    progName = WfRuntime.ProcessContext.OriginalActivity.Process.Descriptor.ProgramName;
                }

                WfProcessBuilderBase builder = (WfProcessBuilderBase)TypeCreator.CreateInstance(builderInfo.Builder.GetType(), appName, progName);

                processDesp = builder.Build(processKey, builderInfo.ProcessName);
            }

            return(processDesp);
        }