public void Clear() { this.FlowInfo = new WorkFlowInfo(); panelWorkFlow.Controls.Clear(); selectedObj = null; tempLine = null; }
/// <summary> ///加载工作流数据 /// </summary> /// <param name="workTaches"></param> public void LoadFlowInfo(WorkFlowInfo flowInfo, string currentTacheId = "") { Clear(); this.FlowInfo.Id = FlowInfo.Id; List <WorkTacheInfo> workTacheInfos = flowInfo.TacheInfos; WorkTache wtStart = CreateTacheToView(); wtStart.TacheType = WorkTacheType.Begin; wtStart.Text = "开始"; SetTacheProperty(wtStart); List <WorkTache> taches = new List <WorkTache>(); taches.Add(wtStart); bool left = false; bool disConnected = false; for (int i = 0; i < workTacheInfos.Count; i++) { WorkTacheInfo item = workTacheInfos[i]; WorkTache wt = CreateTacheToView(); wt.TacheInfo = item; SetTacheProperty(wt); SetTachePosition(taches[i], wt, ref left); if (!disConnected) { ConnectionLineToTache(taches[i], wt, currentTacheId); disConnected = false; } if (workTacheInfos[i].IsDisConnectedFromNext) { disConnected = true; } else { disConnected = false; } taches.Add(wt); } //关联结束节点 if (!disConnected) { WorkTache wtEnd = CreateTacheToView(); wtEnd.TacheType = WorkTacheType.End; wtEnd.Text = "结束"; SetTacheProperty(wtEnd); SetTachePosition(taches.LastOrDefault(), wtEnd, ref left); //必须有环节数据 开始和结束节点才连线 if (workTacheInfos.Count > 0) { ConnectionLineToTache(taches.LastOrDefault(), wtEnd); } } }