Esempio n. 1
0
 public void Clear()
 {
     this.FlowInfo = new WorkFlowInfo();
     panelWorkFlow.Controls.Clear();
     selectedObj = null;
     tempLine    = null;
 }
Esempio n. 2
0
        /// <summary>
        /// 断开环节关联的线
        /// </summary>
        /// <param name="flowLine"></param>
        private void DisconnectTache(FlowLine flowLine)
        {
            if (flowLine.StartControl != null)
            {
                WorkTache workTache = flowLine.StartControl as WorkTache;
                workTache.FlowLine2 = null;
            }

            if (flowLine.EndControl != null)
            {
                WorkTache workTache = flowLine.EndControl as WorkTache;
                workTache.FlowLine1 = null;
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 选中环节中点
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void wt_RadioMouseDown(object sender, MouseEventArgs e)
        {
            if (isReadOnly)
            {
                return;
            }

            if (sender is WorkTache)
            {
                WorkTache w = sender as WorkTache;
                selectedObj = w;
                w.Selected  = true;

                tempLine = new FlowLine();
                tempLine.SetPoint(w.Left + w.Width / 2, w.Top + w.Height / 2, w.Left + w.Width / 2 + 1, w.Top + w.Height / 2 + 1);
                this.panelWorkFlow.Controls.Add(tempLine);

                Refresh();

                this.panelWorkFlow.Capture = true;
            }
        }
Esempio n. 4
0
        private void panelWorkFlow_MouseUp(object sender, MouseEventArgs e)
        {
            if (isReadOnly)
            {
                return;
            }

            this.panelWorkFlow.Capture = false;

            if (tempLine != null && selectedObj is WorkTache)
            {
                WorkTache endTache = GetWorkTacheControl(e.X, e.Y);
                if (endTache == null || endTache.Equals(selectedObj))
                {
                }
                else
                {
                    ConnectionLineToTache(selectedObj as WorkTache, endTache); // 线关联到环节
                }
                this.panelWorkFlow.Controls.Remove(tempLine);
                tempLine = null;
            }
        }
Esempio n. 5
0
        /// <summary>
        /// 将线关联到环节
        /// </summary>
        /// <param name="endTache"></param>
        private FlowLine ConnectionLineToTache(WorkTache startTache, WorkTache endTache, string currentTacheId = "")
        {
            if (startTache == null || endTache == null)
            {
                return(null);
            }
            if (!(startTache is WorkTache))
            {
                return(null);
            }

            if (startTache.TacheType == WorkTacheType.End)
            {
                this.ShowWarning("结束环节不能够作为流程起点!");
                return(null);
            }
            else if (startTache.FlowLine2 != null)
            {
                this.ShowWarning("该环节已经流出!");
                return(null);
            }

            if (endTache.TacheType == WorkTacheType.Begin)
            {
                this.ShowWarning("开始环节不能作为流程终点!");
                return(null);
            }
            else if (endTache.FlowLine1 != null)
            {
                this.ShowWarning("该环节已经流入!");
                return(null);
            }

            if (startTache.IsRelatedTo(endTache))
            {
                //this.ShowWarning("环节已经存在关联,请重新选择环节!");
                return(null);
            }

            if (IsClosedLoop(startTache, endTache))
            {
                this.ShowWarning("流程不能形成闭环!");
                return(null);
            }

            FlowLine line = new FlowLine();

            line.KeyDown    += new KeyEventHandler(control_KeyDown);
            line.MouseClick += new MouseEventHandler(flowLine_MouseClick);

            line.SetPoint(startTache, endTache);
            if (startTache.TacheInfo.IsNextLineDashed)
            {
                //未达到的环节虚线、灰色图标表示
                line.LineStyle     = DashStyle.Dash;
                endTache.TacheType = WorkTacheType.Gray;

                if (startTache.TacheInfo.Id == currentTacheId)
                {
                    startTache.TacheType = WorkTacheType.Current;
                }
            }

            //设置环节关联的线
            startTache.FlowLine2 = line;
            endTache.FlowLine1   = line;

            this.panelWorkFlow.Controls.Add(line);

            return(line);
        }