Ejemplo n.º 1
0
        private void button2_Click(object sender, EventArgs e)
        {
            NAE nae = (NAE)this.listDevices.SelectedItems[0].Tag;

            nae.StaticIPAddress = this.generateStatic(nae.IPAddress);
            frmImport frm = new frmImport();

            foreach (Site site in Sites.FromTreeView(this.mainFrm.treeSites))
            {
                frm.comboSite.Items.Add(site.Name);
            }

            frm.ShowDialog();
            if (frm.DialogResult == DialogResult.OK && !String.IsNullOrEmpty((String)frm.comboSite.SelectedItem))
            {
                String selectedSite = (String)frm.comboSite.SelectedItem;
                foreach (TreeNode node in this.mainFrm.treeSites.Nodes)
                {
                    Site site = (Site)node.Tag;
                    if (selectedSite.Equals(site.Name))
                    {
                        site.NAEs.Add(nae);
                        FormHandler.AddNAEToTree(node.Nodes, nae);
                    }
                }
            }
        }
Ejemplo n.º 2
0
 private void pasteToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (this.treeSites.SelectedNode != null)
     {
         if (!String.IsNullOrEmpty(Clipboard.GetText()))
         {
             try
             {
                 TreeNodeCollection nodes = this.treeSites.SelectedNode.Nodes;
                 XElement           xnae  = XElement.Parse(Clipboard.GetText());
                 FormHandler.AddNAEToTree(nodes, NAE.FromXML(xnae));
             }
             catch (Exception ex)
             {
                 Logger.WriteMessage("Error in pasting NAE.");
                 Logger.WriteException(ex);
                 Logger.PromptLogReview("Failed to paste the NAE, the data in the clipboard may be corrupt.");
             }
         }
     }
 }
Ejemplo n.º 3
0
        private void importNAEToolStripMenuItem1_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter           = "XML Files (*.xml)|*.xml";
            openFileDialog.FilterIndex      = 2;
            openFileDialog.RestoreDirectory = true;

            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                try
                {
                    XElement xnae = XDocument.Load(openFileDialog.FileName).Root;
                    FormHandler.AddNAEToTree(this.treeSites.SelectedNode.Nodes, NAE.FromXML(xnae));
                }
                catch (Exception ex)
                {
                    Logger.WriteMessage("Failed to load XML file: " + openFileDialog.FileName);
                    Logger.WriteException(ex);
                    Logger.PromptLogReview("An error occurred in loading the file, it may be corrupted.");
                }
            }
        }