private void addItemToolStripMenuItem_Click(object sender, EventArgs e) { if (fMSObjs == null) { MessageBox.Show("Please [Load Setting] first!"); return; } using (NewItemForm f = new NewItemForm()) { if (f.ShowDialog() == DialogResult.OK) { FMSbaseObj o = FMSbaseObj.CreateFMSObj(f.Id, f.InputUNC, f.OutputUNC, f.StoreProcedure, f.MaxThread, f.FMSClassName); fMSObjs.Add(o); } } }
private ThreadedBindingList <FMSbaseObj> LoadSettingtoList() { ThreadedBindingList <FMSbaseObj> result = new ThreadedBindingList <FMSbaseObj>(); XmlDocument doc; XmlNode node; try {// load config document for current assembly doc = LoadConfigDocument(); // retrieve TMOConfigurations node = doc.SelectSingleNode("//TMOConfigurations"); if (node != null) { foreach (XmlElement selectNode in node.SelectNodes("//TMOConfiguration")) { try { var _maxt = 1; if (!int.TryParse(selectNode.GetAttribute("MaxProcessThreads"), out _maxt)) { _maxt = 1; } FMSbaseObj o = FMSbaseObj.CreateFMSObj(selectNode.GetAttribute("Id"), selectNode.GetAttribute("InputUNC"), selectNode.GetAttribute("OutputUNC"), selectNode.GetAttribute("StoreProcedure"), _maxt, selectNode.GetAttribute("Classname")); result.Add(o); } catch (Exception ex) { Loghelper.Write(LogLevel.Error, ex.Message); } } } } catch (Exception e) { Loghelper.Write(LogLevel.Error, e.Message); } finally { node = null; doc = null; } return(result); }