Esempio 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);
                }
            }
        }
Esempio n. 2
0
        private void NewNode()
        {
            XmlElement selection = mainList.SelectedItem as XmlElement;

            if (mainList.SelectedItem != null && selection.Name == "tvbv")
            {
                DlgAddNode newNode = new DlgAddNode();
                newNode.Owner = this;
                if (newNode.ShowDialog() == true)
                {
                    TreeViewItem newItem = new TreeViewItem();
                    string       tvbv    = selection.Attributes["name"].Value;
                    XmlElement   pc      = MainList.Document.CreateElement("pc");
                    pc.SetAttribute("name", newNode.FriendlyName);
                    pc.SetAttribute("ipaddress", newNode.IpAddress);
                    pc.SetAttribute("domain", newNode.DomainName);
                    MainList.Document.SelectSingleNode("/pclist/tvbv[@name='" + tvbv + "']").AppendChild(pc);
                    MainList.Document.Save(MainList.Source.OriginalString);
                }
            }
            else
            {
                MessageBox.Show(Lang.msgEmptySelection, Lang.msgEmptySelectionTitle);
            }
        }