Ejemplo n.º 1
0
        private void EditNode()
        {
            XmlElement selection = mainList.SelectedItem as XmlElement;

            if (selection.Name == "tvbv")
            {
                dlgAddGroup newGroup = new dlgAddGroup(selection.GetAttribute("name"));
                newGroup.Owner = this;
                if (newGroup.ShowDialog() == true)
                {
                    selection.SetAttribute("name", newGroup.GroupName);
                    MainList.Document.Save(MainList.Source.OriginalString);
                }
            }
            else if (selection.Name == "pc")
            {
                DlgAddNode newNode = new DlgAddNode(selection.GetAttribute("ipaddress"),
                                                    selection.GetAttribute("domain"),
                                                    selection.GetAttribute("name"));
                newNode.Owner = this;
                if (newNode.ShowDialog() == true)
                {
                    selection.SetAttribute("name", newNode.FriendlyName);
                    selection.SetAttribute("ipaddress", newNode.IpAddress);
                    selection.SetAttribute("domain", newNode.DomainName);
                    MainList.Document.Save(MainList.Source.OriginalString);
                }
            }
        }
Ejemplo n.º 2
0
        private void NewGroup()
        {
            dlgAddGroup newGroup = new dlgAddGroup();

            newGroup.Owner = this;
            if (newGroup.ShowDialog() == true)
            {
                XmlElement node = MainList.Document.CreateElement("tvbv");
                node.SetAttribute("name", newGroup.GroupName);
                MainList.Document.DocumentElement.AppendChild(node);
                MainList.Document.Save(MainList.Source.OriginalString);
            }
        }