Exemplo n.º 1
0
        private void ActionNew(object sender, EventArgs e)
        {
            if (this.CloseCurrentWorkspace())
            {
                var frmNewDocument = new FrmDocumentPropertyEditor();
                if (frmNewDocument.ShowDialog() == DialogResult.OK)
                {
                    this.ResetMenuToolStatus();

                    this.workspace = Workspace.New(
                        this.WorkspaceModified,
                        this.WorkspaceSaved,
                        frmNewDocument.WorkspaceSettings);

                    this.LoadWorkspace(this.workspace);


                    this.editor.Text          = null;
                    this.editor.Enabled       = false;
                    this.browser.DocumentText = null;

                    this.mnuClose.Enabled             = true;
                    this.mnuProperties.Enabled        = true;
                    this.mnuOpenWorkingFolder.Enabled = true;
                }
            }
        }
Exemplo n.º 2
0
        private void ActionOpen(object sender, EventArgs e)
        {
            if (this.CloseCurrentWorkspace())
            {
                if (this.openDocumentDialog.ShowDialog() == DialogResult.OK)
                {
                    this.workspace = Workspace.Open(
                        this.WorkspaceModified,
                        this.WorkspaceSaved,
                        this.openDocumentDialog.FileName);

                    this.LoadWorkspace(this.workspace);

                    this.ResetMenuToolStatus();
                    this.editor.Text          = null;
                    this.editor.Enabled       = false;
                    this.browser.DocumentText = null;

                    this.mnuClose.Enabled             = true;
                    this.mnuProperties.Enabled        = true;
                    this.mnuOpenWorkingFolder.Enabled = true;



                    if (!templateReader.Exists(this.workspace.Document.TemplateId))
                    {
                        if (MessageBox.Show(
                                Resources.TemplateDoesNotExistConfirmMessage,
                                Resources.Confirmation,
                                MessageBoxButtons.YesNo,
                                MessageBoxIcon.Question) == DialogResult.Yes)
                        {
                            var frmDocumentPropertyEditor = new FrmDocumentPropertyEditor(this.workspace.Document);
                            if (frmDocumentPropertyEditor.ShowDialog() == DialogResult.OK)
                            {
                                var settings = frmDocumentPropertyEditor.WorkspaceSettings;
                                this.workspace.Document.Title      = settings.DocumentTitle;
                                this.workspace.Document.Author     = settings.DocumentAuthor;
                                this.workspace.Document.Version    = settings.Version;
                                this.workspace.Document.TemplateId = settings.TemplateId;
                                var documentTreeNode =
                                    tvWorkspace.Nodes.Find(this.workspace.Document.Id.ToString(), false).First();
                                documentTreeNode.Text = this.workspace.Document.Title;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 3
0
 private void ActionEditDocumentProperty(object sender, EventArgs e)
 {
     if (this.workspace != null && this.workspace.Document != null)
     {
         var frmDocumentPropertyEditor = new FrmDocumentPropertyEditor(this.workspace.Document);
         if (frmDocumentPropertyEditor.ShowDialog() == DialogResult.OK)
         {
             var settings = frmDocumentPropertyEditor.WorkspaceSettings;
             this.workspace.Document.Title      = settings.DocumentTitle;
             this.workspace.Document.Author     = settings.DocumentAuthor;
             this.workspace.Document.Version    = settings.Version;
             this.workspace.Document.TemplateId = settings.TemplateId;
             var documentTreeNode = tvWorkspace.Nodes.Find(this.workspace.Document.Id.ToString(), false).First();
             documentTreeNode.Text = this.workspace.Document.Title;
         }
     }
 }