예제 #1
0
        private void Save(FlowEngine flowEngine)
        {
            if (flowEngine.Attachment.Owner == -1)
            {
                throw new ArgumentException("Owner is null");
            }
            if (flowEngine.FlowState != FlowState.Finished)
            {
                FlowKey flowKey = new FlowKey()
                {
                    Owner = flowEngine.Attachment.Owner
                };
                if (!this.dicFlow.ContainsKey(flowKey))
                {
                    this.dicFlow.Add(flowKey, flowEngine);
                }
                else if (flowEngine.GetCurrent() == null)
                {
                    this.dicFlow.Remove(flowKey);
                }
                else if (this.dicFlow.ContainsKey(flowKey))
                {
                    this.dicFlow[flowKey] = flowEngine;
                }
            }
            string fileName = FlowManager.GetFlowFile(flowEngine.Attachment.Owner);

            FlowEngine.Save(fileName, flowEngine);
        }
예제 #2
0
        public void Remove(int owner)
        {
            FlowKey flowKey = new FlowKey()
            {
                Owner = owner
            };

            if (this.dicFlow.ContainsKey(flowKey))
            {
                this.dicFlow.Remove(flowKey);
            }
        }
예제 #3
0
        /// <summary>
        /// 加载流程文件
        /// </summary>
        /// <param name="category">分类</param>
        /// <param name="owner">属主</param>
        /// <returns></returns>
        public FlowEngine Load(int owner)
        {
            FlowKey flowKey = new FlowKey()
            {
                Owner = owner
            };

            if (this.dicFlow.ContainsKey(flowKey))
            {
                return(this.dicFlow[flowKey]);
            }
            string     fileName   = FlowManager.GetFlowFile(owner);
            FlowEngine flowEngine = FlowEngine.Load(fileName);

            flowEngine.FinishedHandler -= new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
            flowEngine.FinishedHandler += new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
            if (flowEngine.FlowState != FlowState.Finished && !this.dicFlow.ContainsKey(flowKey))
            {
                this.dicFlow.Add(flowKey, flowEngine);
            }
            return(flowEngine);
        }
예제 #4
0
        public override bool Equals(object obj)
        {
            FlowKey other = (FlowKey)obj;

            return(this.Owner == other.Owner);
        }
예제 #5
0
 private void Save(FlowEngine flowEngine)
 {
     if (flowEngine.Attachment.Owner == -1)
     {
         throw new ArgumentException("Owner is null");
     }
     if (flowEngine.FlowState != FlowState.Finished)
     {
         FlowKey flowKey = new FlowKey() { Owner = flowEngine.Attachment.Owner };
         if (!this.dicFlow.ContainsKey(flowKey))
         {
             this.dicFlow.Add(flowKey, flowEngine);
         }
         else if (flowEngine.GetCurrent() == null)
         {
             this.dicFlow.Remove(flowKey);
         }
         else if (this.dicFlow.ContainsKey(flowKey))
         {
             this.dicFlow[flowKey] = flowEngine;
         }
     }
     string fileName = FlowManager.GetFlowFile(flowEngine.Attachment.Owner);
     FlowEngine.Save(fileName, flowEngine);
 }
예제 #6
0
 public void Remove(int owner)
 {
     FlowKey flowKey = new FlowKey() { Owner = owner };
     if (this.dicFlow.ContainsKey(flowKey))
     {
         this.dicFlow.Remove(flowKey);
     }
 }
예제 #7
0
 /// <summary>
 /// 加载流程文件
 /// </summary>
 /// <param name="category">分类</param>
 /// <param name="owner">属主</param>
 /// <returns></returns>
 public FlowEngine Load(int owner)
 {
     FlowKey flowKey = new FlowKey() { Owner = owner };
     if (this.dicFlow.ContainsKey(flowKey))
     {
         return this.dicFlow[flowKey];
     }
     string fileName = FlowManager.GetFlowFile(owner);
     FlowEngine flowEngine = FlowEngine.Load(fileName);
     flowEngine.FinishedHandler -= new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
     flowEngine.FinishedHandler += new FlowEngine.FinishedEventHandler(FlowManager.FlowFinished);
     if (flowEngine.FlowState != FlowState.Finished && !this.dicFlow.ContainsKey(flowKey))
     {
         this.dicFlow.Add(flowKey, flowEngine);
     }
     return flowEngine;
 }