Exemplo n.º 1
0
        public override void OnPreparatory()
        {
            base.OnPreparatory();

            //流程初始化
            foreach (var procedureInstance in _procedureInstances)
            {
                procedureInstance.Value.OnInit();
            }

            //进入默认流程
            if (DefaultProcedure != "")
            {
                Type type = GlobalTools.GetTypeInRunTimeAssemblies(DefaultProcedure);
                if (type != null)
                {
                    if (_procedureInstances.ContainsKey(type))
                    {
                        _currentProcedure = _procedureInstances[type];
                        _currentProcedure.OnEnter(null);
                    }
                    else
                    {
                        throw new HTFrameworkException(HTFrameworkModule.Procedure, "进入流程失败:不存在流程 " + type.Name + " 或者流程未激活!");
                    }
                }
                else
                {
                    throw new HTFrameworkException(HTFrameworkModule.Procedure, "进入流程失败:丢失流程 " + DefaultProcedure + " !");
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 切换流程
        /// </summary>
        /// <param name="type">目标流程</param>
        public void SwitchProcedure(Type type)
        {
            if (Procedures.ContainsKey(type))
            {
                if (CurrentProcedure == Procedures[type])
                {
                    return;
                }

                ProcedureBase lastProcedure = CurrentProcedure;
                ProcedureBase nextProcedure = Procedures[type];
                if (lastProcedure != null)
                {
                    lastProcedure.OnLeave(nextProcedure);
                }
                nextProcedure.OnEnter(lastProcedure);
                CurrentProcedure = nextProcedure;

                AnyProcedureSwitchEvent?.Invoke(lastProcedure, nextProcedure);
            }
            else
            {
                throw new HTFrameworkException(HTFrameworkModule.Procedure, "切换流程失败:不存在流程 " + type.Name + " 或者流程未激活!");
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 切换流程
        /// </summary>
        /// <param name="type">目标流程</param>
        public void SwitchProcedure(Type type)
        {
            if (_procedureInstances.ContainsKey(type))
            {
                if (_currentProcedure == _procedureInstances[type])
                {
                    return;
                }

                ProcedureBase lastProcedure = _currentProcedure;
                ProcedureBase nextProcedure = _procedureInstances[type];
                if (lastProcedure != null)
                {
                    lastProcedure.OnLeave(nextProcedure);
                }
                nextProcedure.OnEnter(lastProcedure);
                _currentProcedure = nextProcedure;
            }
            else
            {
                throw new HTFrameworkException(HTFrameworkModule.Procedure, "切换流程失败:不存在流程 " + type.Name + " 或者流程未激活!");
            }
        }