private void New() { if (Document.DocumentManager.ActiveDocument != null) { if (Document.DocumentManager.ActiveDocument.IsModified) { DialogResult dr = MessageBox.Show("Do you want to save the changes to the curent document?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { bool savingSucceeded = Save(); if (!savingSucceeded) { return; // If the doc is still dirty, it means that Save failed. We must not replace the current document with another one. } } else if (dr == DialogResult.Cancel) { return; } } } Document.Project project = Document.Project.New(); // Demo document creation project.Site.Contents.Add(new Document.File("1.aspx", "1-a.aspx")); project.Site.Contents.Add(new Document.File("2.aspx", "2-a.aspx")); Document.Folder folder = new Owasp.Osg.Controller.Document.Folder("pages"); folder.Contents.Add(new Document.File("1.htm", "1-a.htm")); folder.Contents.Add(new Document.File("2.htm", "2-a.htm")); Document.Folder folder2 = new Owasp.Osg.Controller.Document.Folder("jsp"); folder2.Contents.Add(new Document.File("1.jsp", "1-a.jsp")); folder2.Contents.Add(new Document.File("2.jsp", "2-a.jsp")); folder.Contents.Add(folder2); project.Site.Contents.Add(folder); // END: Demo document creation siteTreeControl1.Project = project; Document.DocumentManager.ActiveDocument = project; //p.Modified += new EventHandler<Document.DocumentPartModifiedEventArgs>(OnDocumentModified); Text = Document.DocumentManager.ActiveDocument.Title + " - OWASP Tiger"; //splitContainer1.Panel1.SuspendLayout(); //splitContainer1.Panel1.BackColor = SystemColors.AppWorkspace; //splitContainer1.Panel1.Controls.Clear(); //splitContainer1.Panel1.ResumeLayout(); }
private void New() { if (Document.DocumentManager.ActiveDocument != null) { if (Document.DocumentManager.ActiveDocument.IsModified) { DialogResult dr = MessageBox.Show("Do you want to save the changes to the curent document?", "Warning", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { bool savingSucceeded = Save(); if (!savingSucceeded) return; // If the doc is still dirty, it means that Save failed. We must not replace the current document with another one. } else if (dr == DialogResult.Cancel) return; } } Document.Project project = Document.Project.New(); // Demo document creation project.Site.Contents.Add(new Document.File("1.aspx", "1-a.aspx")); project.Site.Contents.Add(new Document.File("2.aspx", "2-a.aspx")); Document.Folder folder = new Owasp.Osg.Controller.Document.Folder("pages"); folder.Contents.Add(new Document.File("1.htm", "1-a.htm")); folder.Contents.Add(new Document.File("2.htm", "2-a.htm")); Document.Folder folder2 = new Owasp.Osg.Controller.Document.Folder("jsp"); folder2.Contents.Add(new Document.File("1.jsp", "1-a.jsp")); folder2.Contents.Add(new Document.File("2.jsp", "2-a.jsp")); folder.Contents.Add(folder2); project.Site.Contents.Add(folder); // END: Demo document creation siteTreeControl1.Project = project; Document.DocumentManager.ActiveDocument = project; //p.Modified += new EventHandler<Document.DocumentPartModifiedEventArgs>(OnDocumentModified); Text = Document.DocumentManager.ActiveDocument.Title + " - OWASP Tiger"; //splitContainer1.Panel1.SuspendLayout(); //splitContainer1.Panel1.BackColor = SystemColors.AppWorkspace; //splitContainer1.Panel1.Controls.Clear(); //splitContainer1.Panel1.ResumeLayout(); }