private void ShowRenamePageDialog(string readervalue, out string newpagename) { readervalue = "Page " + (view.Pages.Count + 1).ToString(); Dialogs.RenamePageDialog dialog = new Dialogs.RenamePageDialog(mediator.Canvas.MainForm, view); dialog.PageName = readervalue; DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { newpagename = dialog.PageName; } else { newpagename = ""; } }
/// <summary> /// Renames a page in a view /// </summary> /// <param name="node">Page node of the page to be renamed</param> private void RenamePage(PageNode node) { RenamePageDialog dialog = new RenamePageDialog(this.MainForm, node); dialog.PageName = node.Text; DialogResult result = dialog.ShowDialog(); if (result == DialogResult.OK) { string strOldPageName = node.Text; node.Text = dialog.PageName; node.Page.Name = dialog.PageName; node.Page.SaveToDb(); //--EI-52 UpdatePageNameinCheckCode(strOldPageName, dialog.PageName); //-- ViewNode viewNode = (ViewNode)node.Parent; Page foundPage = viewNode.View.Pages.Find(delegate(Page p) { return p.Id == node.Page.Id; }); foundPage.Name = dialog.PageName; PageSelected(SelectedPage); } }
public void InsertPage(TreeNode pageTreeNode) { if (pageTreeNode is PageNode) { PageNode pageNode = (PageNode)pageTreeNode; ViewNode viewTreeNode = (ViewNode)pageNode.Parent; RenamePageDialog dialog = new RenamePageDialog(this.mainForm, ((ViewNode)viewTreeNode).View); dialog.PageName = "InsertPage"; DialogResult result = dialog.ShowDialog(); string pageName = dialog.PageName; if (result == DialogResult.OK) { Page page = ((ViewNode)viewTreeNode).View.CreatePage(pageName, pageNode.Index); PageNode node = ((ViewNode)viewTreeNode).InsertPageNode(page, pageNode.Index); projectTree.SelectedNode = node; foreach (TreeNode eachNode in pageTreeNode.Parent.Nodes) { if (eachNode is PageNode) { ((PageNode)eachNode).Page.Position = eachNode.Index; ((PageNode)eachNode).Page.SaveToDb(); } } } } }
/// <summary> /// Add a page to a view's tree node /// </summary> /// <param name="treeNode">The parent node of the page node to be added</param> public void AddPage(TreeNode viewTreeNode) { RenamePageDialog dialog = new RenamePageDialog(this.mainForm, ((ViewNode)viewTreeNode).View); View currentView = ((ViewNode)viewTreeNode).View; string pageName = "Page " + (currentView.Pages.Count + 1).ToString(); dialog.PageName = pageName; DialogResult result = dialog.ShowDialog(); pageName = dialog.PageName; if (result == DialogResult.OK) { CreateAndInsertNewPage(viewTreeNode, pageName); } }