private void copyToolStripMenuItem1_Click(object sender, EventArgs e) { TreeNode node = this.treeSites.SelectedNode; NAE nae = (NAE)node.Tag; Clipboard.SetText(nae.ToXML().ToString()); }
private void exportToolStripMenuItem2_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); NAE nae = (NAE)this.treeSites.SelectedNode.Tag; saveFileDialog.Filter = "XML Files (*.xml)|*.xml"; saveFileDialog.FilterIndex = 2; saveFileDialog.RestoreDirectory = true; saveFileDialog.FileName = nae.Name + ".xml"; if (saveFileDialog.ShowDialog() == DialogResult.OK) { try { XDocument document = new XDocument(nae.ToXML()); document.Save(saveFileDialog.FileName); } catch (Exception ex) { Logger.WriteMessage("Failed to save XML file: " + saveFileDialog.FileName); Logger.WriteException(ex); Logger.PromptLogReview("An error occurred in saving the file, you may not have appropriate permissions."); } } }