private void EditMenuItem_Click(object sender, EventArgs e)
 {
     using (EditTemplate dialog = new EditTemplate(this.Template))
     {
         if (dialog.ShowDialog() == DialogResult.OK)
             UpdateNode();
     }
 }
        private void NewTemplateMenuItem_Click(object sender, EventArgs e)
        {
            using (EditTemplate dialog = new EditTemplate(this.Project))
            {
                if (dialog.ShowDialog() == DialogResult.OK)
                {
                    string newTemplateFilePath = Configuration.CodeBase + "\\Resources\\Templates\\NewTemplate.xslt";

                    try
                    {
                        //If they are creating a new file, copy the template over.
                        if (!File.Exists(dialog.Template.XsltAbsolutePath))
                        {
                            if (File.Exists(newTemplateFilePath))
                                File.Copy(newTemplateFilePath, dialog.Template.XsltAbsolutePath);
                            else
                                File.Create(dialog.Template.XsltAbsolutePath).Dispose();
                        }
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("An error occurred while creating the new template file: " + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }

                    this.Project.Templates.Add(dialog.Template);

                    RefreshTemplatesNode();
                }
            }
        }