private void FillFormWithProcessChain(ProcessChain processChain) { foreach (var modelName in processChain.GetModelNames()) { EpisModels_AR.AddTextToList(modelName); } foreach (var procName in processChain.GetProcessNames()) { EpisProcess_ARE.AddTextToList(procName); } }
private void openToolStripMenuItem_Click(object sender, EventArgs e) { if (openFileDialog1.ShowDialog() != DialogResult.OK) { return; } ProcessChain newChain = null; string path = openFileDialog1.FileName; string[] data = File.ReadAllLines(path); newChain = ProcessChain.FromText(data); if (newChain != null) { _processChain = newChain; FillFormWithProcessChain(_processChain); } else { MessageBox.Show(Resources.Loading_epc_Error); } }
protected override Boolean Run(XmlElement state) { try { if (!this.IsReady()) { return(false); } PopInputValue(); String fileModel = this.GetInputValue("ModelFile") as String; if (String.IsNullOrEmpty(fileModel)) { return(false); } ParameterSet paraSet = this.GetInputValue("ParaSet") as ParameterSet; if (null == paraSet) { return(false); } ProcessChain chain = new ProcessChain(); XmlDocument doc = new XmlDocument(); doc.Load(fileModel); XmlElement root = doc.DocumentElement; foreach (XmlNode node in root.GetElementsByTagName("operation")) { chain.AddProcess(node.Attributes["name"].Value, Int32.Parse(node.Attributes["id"].Value)); } Int32 prevID = 0; Int32 backID = 0; foreach (XmlNode linknode in root.GetElementsByTagName("link")) { prevID = Int32.Parse(linknode.Attributes["from"].Value); backID = Int32.Parse(linknode.Attributes["to"].Value); foreach (XmlNode assignnode in linknode.SelectNodes("assign")) { chain.ConnectProcesses(prevID, backID, assignnode.SelectNodes("from")[0].InnerText, assignnode.SelectNodes("to")[0].InnerText); } } String[] strs = null; IProcess process = null; foreach (String key in paraSet.Keys) { strs = key.Split('.'); if (3 != strs.Length) { return(false); } process = chain.GetProcessById(Int32.Parse(strs[1])); if (null == process) { return(false); } process.SetInputValue(strs[2], paraSet[key]); } return(chain.Execute()); } catch (Exception ex) { IRunningLogger logger = InstanceManager.Instance.Context.GetVariable("RunningLogger") as IRunningLogger; if (null != logger) { logger.Error("sample.ProcessValidateModelFile", ex.Message); } } finally { } return(false); }
public void SetEpisModel(EpistemicModel model) { _processChain = new ProcessChain(model); }
protected override Boolean Run(XmlElement state) { try { if (!this.IsReady()) { return false; } PopInputValue(); String fileModel = this.GetInputValue("ModelFile") as String; if (String.IsNullOrEmpty(fileModel)) { return false; } ParameterSet paraSet = this.GetInputValue("ParaSet") as ParameterSet; if (null == paraSet) { return false; } ProcessChain chain = new ProcessChain(); XmlDocument doc = new XmlDocument(); doc.Load(fileModel); XmlElement root = doc.DocumentElement; foreach (XmlNode node in root.GetElementsByTagName("operation")) { chain.AddProcess(node.Attributes["name"].Value, Int32.Parse(node.Attributes["id"].Value)); } Int32 prevID = 0; Int32 backID = 0; foreach (XmlNode linknode in root.GetElementsByTagName("link")) { prevID = Int32.Parse(linknode.Attributes["from"].Value); backID = Int32.Parse(linknode.Attributes["to"].Value); foreach (XmlNode assignnode in linknode.SelectNodes("assign")) { chain.ConnectProcesses(prevID, backID, assignnode.SelectNodes("from")[0].InnerText, assignnode.SelectNodes("to")[0].InnerText); } } String[] strs = null; IProcess process = null; foreach (String key in paraSet.Keys) { strs = key.Split('.'); if (3 != strs.Length) { return false; } process = chain.GetProcessById(Int32.Parse(strs[1])); if (null == process) { return false; } process.SetInputValue(strs[2], paraSet[key]); } return chain.Execute(); } catch (Exception ex) { IRunningLogger logger = InstanceManager.Instance.Context.GetVariable("RunningLogger") as IRunningLogger; if (null != logger) { logger.Error("sample.ProcessValidateModelFile", ex.Message); } } finally { } return false; }