예제 #1
0
        private void OKButton_Click(object sender, EventArgs e)
        {
            if (NameEntered)
            {
                ProjectInfo project = new ProjectInfo
                                  {
                                      Name = _nameTextBox.Text,
                                      Default = _defaultTextBox.Text,
                                      Basedir = _basedirTextBox.Text,
                                      Description = _descriptionTextBox.Text
                                  };

                OnNewProject(project);

                Close();
            }
            else
            {
                MessageBox.Show("A name is required.", "Missing Name");
            }
        }
예제 #2
0
        public static string GetNewDocumentContents(ProjectInfo projectInfo)
        {
            string contents = String.Empty;
            #if DEBUG
            string path = BLANK_PROJECT;
            #else
            string path = Path.Combine(Path.Combine("..", "Data"), BLANK_PROJECT);
            #endif
            XmlDocument xml = new XmlDocument();

            try
            {
                xml.Load(path);
                PopulateDom(xml, projectInfo);
                contents = ConvertDomToText(xml);
            }
            catch
            {
                Errors.ProjectTemplateMissing();
            }

            return contents;
        }
예제 #3
0
 internal NewProjectEventArgs(ProjectInfo info)
 {
     Assert.NotNull(info, "info");
     Info = info;
 }
예제 #4
0
 private void OnNewProject(ProjectInfo info)
 {
     if (NewClicked != null)
         NewClicked(this, new NewProjectEventArgs(info));
 }
예제 #5
0
        private static void PopulateDom(XmlDocument xml, ProjectInfo projectInfo)
        {
            XmlElement element = xml.GetElementsByTagName("project")[0] as XmlElement;
            if (element != null)
            {
                element.Attributes["name"].Value = projectInfo.Name;
                element.Attributes["default"].Value = projectInfo.Default;

                if (String.IsNullOrEmpty(projectInfo.Basedir))
                    element.RemoveAttribute("basedir");
                else
                    element.Attributes["basedir"].Value = projectInfo.Basedir;
            }

            XmlNode node = xml.GetElementsByTagName("description")[0];
            node.InnerText = projectInfo.Description;

            node = xml.GetElementsByTagName("target")[0];
            node.Attributes["name"].Value = projectInfo.Default;
            node.Attributes["description"].Value = projectInfo.Default;
        }