public bool LoadWorkFlowProj(XmlElement source) { XmlElement projNode = source; if (projNode.Name != "work_wlow_project") { return(false); } Name = projNode.GetAttribute("name"); DB_Config = projNode.GetAttribute("db"); XmlNodeList wfs = projNode.SelectNodes("work_flow"); foreach (XmlNode xn in wfs) { XmlElement xe = (XmlElement)xn; WorkFlowMan wfm = NewWrokFlowMan(xe.GetAttribute("name"), xe.GetAttribute("desc"), false); if (!wfm.LoadWorkFlow(xe)) { return(false); } } XmlNodeList records = projNode.SelectSingleNode("record_items").SelectNodes("item"); if (Record_Items == null) { Record_Items = new ObservableCollection <RecordItem>(); } foreach (XmlNode ri in records) { Record_Items.Add(new RecordItem() { Name = ((XmlElement)ri).GetAttribute("name"), Desc = ((XmlElement)ri).GetAttribute("desc") }); } DB_Config = projNode.SelectSingleNode("database").Attributes["connection"].Value; XmlElement app_res = (XmlElement)projNode.SelectSingleNode("param_app"); Param_AppRes.Clear(); if (app_res != null) { foreach (XmlNode res in app_res.SelectNodes("item")) { Param_AppRes.Add(res.InnerText); } } return(true); }
public void UnlinkOtherWFM(WorkFlowMan wfm) { if (wfm == null) { return; } foreach (ConfigItem ci in wf_itmes) { if (ci.GetType().Name == "ConfigSubEvent") { if (((ConfigSubEvent)ci).LinkWorkFLow == wfm.Name) { ((ConfigSubEvent)ci).LinkWorkFLow = ""; ((ConfigSubEvent)ci).LinkParams.Clear(); } } } }
/// <summary> /// 添加一个新工作流管理 /// </summary> /// <param name="wfName">工作流名称</param> /// <param name="wfDesc">工作流描述</param> /// <returns>添加成功则返回新建的WorkFlowMan</returns> public WorkFlowMan NewWrokFlowMan(string wfName, string wfDesc, bool init = true) { foreach (WorkFlowMan i in wfs_man) { if (i.Name == wfName) { return(null); } } WorkFlowMan wfm = new WorkFlowMan(wfName, wfDesc); wfm.Proj = this; if (init == true) { wfm.InitStartAndEnd(); } wfs_man.Add(wfm); return(wfm); }
public WorkFlowMan DeleteWorkFlowMan(string wfName) { WorkFlowMan deleted = null; foreach (WorkFlowMan i in wfs_man) { if (i.Name == wfName) { wfs_man.Remove(i); deleted = i; break; } } foreach (WorkFlowMan j in wfs_man) { j.UnlinkOtherWFM(deleted); } return(deleted); }