Ejemplo n.º 1
0
        /// <summary>
        /// 解析XML
        /// </summary>
        /// <param name="ComputeNodeFilePath"></param>
        /// <param name="TaskFilePath"></param>
        /// <returns></returns>
        public static List <GofComputeNode> LoadGofComputeNodes(string ComputeNodeFilePath, string TaskFilePath)
        {
            XmlDocument doc = new XmlDocument();

            doc.Load(ComputeNodeFilePath);

            var tasks = new GofTaskMgr(TaskFilePath).GetAllTasks();

            List <GofComputeNode> list = new List <GofComputeNode>();

            foreach (XmlNode item in doc.DocumentElement.ChildNodes)
            {
                GofComputeNode node = new GofComputeNode();
                node.Id      = int.Parse(item.SelectSingleNode("./Id").InnerText);
                node.Name    = item.SelectSingleNode("./Name").InnerText;
                node.Ip      = item.SelectSingleNode("./IP").InnerText;
                node.Port    = int.Parse(item.SelectSingleNode("./Port").InnerText);
                node.Enabled = Boolean.Parse(item.SelectSingleNode("./Enabled").InnerText);

                List <int> taskId = BerComputeNode.ParseTaskIdsString(item.SelectSingleNode("./TaskId").InnerText);
                try
                {
                    node.Tasks = tasks.FindAll(m => taskId.Contains(m.Id));
                }
                catch (Exception ex) { MessageBox.Show(ex.Message); }

                list.Add(node);
            }
            return(list);
        }
Ejemplo n.º 2
0
 /// <summary>
 /// 绑定数据
 /// </summary>
 private void DataBind()
 {
     taskMgr = new GofTaskMgr(Setting.GnsserConfig.GofTaskFilePath);
     tasks   = taskMgr.GetAllTasks();
     BindMain();
 }
Ejemplo n.º 3
0
 private void BindMain()
 {
     mgr   = new GofTaskMgr(Setting.GnsserConfig.GofTaskFilePath);
     tasks = mgr.GetAllTasks();
     this.bindingSource_task.DataSource = tasks;
 }