Ejemplo n.º 1
0
        public DocumentView ShowDocument(string fileName)
        {
            Document     doc  = OpenDocument(fileName);
            DocumentView view = (doc == null) ? null : mMainWindow.ShowDocument(doc);

            if (view == null)
            {
                MessageBox.Show(mMainWindow, "The document '" + fileName + "'could not be opened.", "Load Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
            return(view);
        }
Ejemplo n.º 2
0
        void AddNewDocument_Click(object sender, EventArgs e)
        {
            if (projectView.SelectedNode == null)
            {
                return;
            }

            Folder folder = FindFolder(projectView.SelectedNode);

            if (folder == null)
            {
                return;
            }

            if (folder.ProjectDocument.ReadOnly && !folder.ProjectDocument.Checkout())
            {
                return;
            }

            Type docType = (sender as ToolStripMenuItem).Tag as Type;
            DocumentClassAttribute attr = DocumentClassAttribute.ForType(docType);

            string       fileName = Path.Combine(folder.AbsolutePath, "New " + attr.Name + attr.FileExtensions[0]);
            DocumentItem docItem  = m_manager.Project.AddDocument(folder, fileName, docType);
            Document     doc      = m_manager.CreateDocument(fileName, docType);

            m_mainWindow.ShowDocument(doc);
        }