Example #1
0
        /// <summary>
        /// Assumes the memento is the Node ID (FieldGuid)
        /// </summary>
        /// <param name="memento"></param>
        /// <returns></returns>
        public override IDocument CreateDocument(string memento)
        {
            if (memento == null)
            {
                throw new ArgumentNullException();
            }

            if (!m_docs.ContainsKey(memento))
            {
                ISolutionItem item = null;
                if (FieldGuid.CheckSyntax(memento))
                {
                    item = solutionPad.FindItemByNodeId(new Guid(memento)) as ISolutionItem;
                }

                if (item != null && item is PageItem)
                {
                    var pe = new PageEditor(item as PageItem); // adds itself to m_docs
                }
                else
                {
                    return(null);
                }
            }
            return(m_docs[memento]);
        }
Example #2
0
 public PageEditorItem(PageEditor parent, NodePage page)
     : base(null)
 {
     if (page == null)
     {
         throw new ArgumentNullException();
     }
     m_parent    = parent;
     WorkingCopy = page;
 }
Example #3
0
        public void DeleteConditional(bool verify)
        {
            if (runtimeService.DisconnectDialog(this))
            {
                bool       needsVerification = false;
                PageEditor pageEditorForThis = null;
                foreach (var d in layoutManager.Value.Documents)
                {
                    var pageEditor = d as PageEditor;
                    if (pageEditor != null)
                    {
                        if (pageEditor.PageItemParent == this)
                        {
                            pageEditorForThis = pageEditor;
                            if (pageEditor.EditorRoot.WorkingCopy.NodeInstructionGroupChildren.Count > 0)
                            {
                                needsVerification = true && verify;
                                break;
                            }
                        }
                    }
                }
                if (Page.NodeInstructionGroupChildren.Count > 0)
                {
                    needsVerification = true && verify;
                }

                if (needsVerification)
                {
                    if (messagingService.Value.ShowDialog(Resources.Strings.Solution_Pad_PageItem_DeleteConfirmation,
                                                          Resources.Strings.Solution_Pad_PageItem_DeleteTitle, System.Windows.Forms.MessageBoxButtons.OKCancel)
                        == System.Windows.Forms.DialogResult.Cancel)
                    {
                        return;
                    }
                }
                if (pageEditorForThis != null)
                {
                    layoutManager.Value.CloseDocument(pageEditorForThis);
                }
                FireDeletedEvent(this, Node);
            }
        }