Esempio n. 1
0
        /// <summary>
        /// 添加一个节点
        /// </summary>
        /// <param name="node"></param>
        public void Add(BaseComputeNode node)
        {
            XmlElement e     = doc.CreateElement("Node");
            XmlElement nName = doc.CreateElement("Name");

            nName.InnerText = node.Name;
            e.AppendChild(nName);
            XmlElement nNumber = doc.CreateElement("Id");

            nNumber.InnerText = node.Id.ToString();
            e.AppendChild(nNumber);
            XmlElement eIp = doc.CreateElement("IP");

            eIp.InnerText = node.Ip;
            e.AppendChild(eIp);
            XmlElement ePort = doc.CreateElement("Port");

            ePort.InnerText = node.Port.ToString();
            e.AppendChild(ePort);
            XmlElement t = doc.CreateElement("TaskId");

            t.InnerText = node.GetTaskIdsString();
            e.AppendChild(t);
            XmlElement te = doc.CreateElement("Enabled");

            te.InnerText = node.Enabled + "";
            e.AppendChild(te);

            doc.DocumentElement.AppendChild(e);
        }
Esempio n. 2
0
        /// <summary>
        /// 相等否
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public override bool Equals(object obj)
        {
            BaseComputeNode o = obj as BaseComputeNode;

            if (o == null)
            {
                return(false);
            }

            return(Ip == o.Ip);
        }
Esempio n. 3
0
        /// <summary>
        /// 编辑指定节点
        /// </summary>
        /// <param name="node"></param>
        /// <param name="index"></param>
        public void Edit(BaseComputeNode node, int index)
        {
            XmlNode item = doc.DocumentElement.ChildNodes[index];

            item.SelectSingleNode("./Name").InnerText    = node.Name;
            item.SelectSingleNode("./Id").InnerText      = node.Id.ToString();
            item.SelectSingleNode("./IP").InnerText      = node.Ip;
            item.SelectSingleNode("./Port").InnerText    = node.Port + "";
            item.SelectSingleNode("./TaskId").InnerText  = node.GetTaskIdsString();
            item.SelectSingleNode("./Enabled").InnerText = node.Enabled + "";
        }
Esempio n. 4
0
 private void button_ok_Click(object sender, EventArgs e)
 {
     if (ComputeNode == null)
     {
         computeNode = new BaseComputeNode();
     }
     try
     {
         ComputeNode.Name    = this.textBox_name.Text.Trim();
         ComputeNode.Ip      = this.textBox_ip.Text.Trim();
         ComputeNode.Port    = int.Parse(this.textBox_port.Text.Trim());
         ComputeNode.Id      = int.Parse(this.textBox_number.Text);
         ComputeNode.Enabled = this.checkBox_enabled.Checked;
     }
     catch (Exception ex) { MessageBox.Show(ex.Message); }
     this.DialogResult = System.Windows.Forms.DialogResult.OK;
 }
Esempio n. 5
0
 public ComputeNodeEditForm(BaseComputeNode ComputeNode)
 {
     InitializeComponent();
     Init();
     this.ComputeNode = ComputeNode;
 }