Exemplo n.º 1
0
 /// <summary>
 /// Constructor for the class
 /// </summary>
 /// <param name="frm">The calling form</param>
 /// <param name="node">The original page node</param>        
 public RenamePageDialog(MainForm frm, PageNode node)
     : base(frm)
 {
     // This call is required by the Windows Form Designer.
     InitializeComponent();
     this.PageNode = node;
     this.parentView = node.Page.view;
 }
Exemplo n.º 2
0
 /// <summary>
 /// Inserts a page node for a given page
 /// </summary>
 /// <param name="page">Page in which node is to be inserted</param>
 /// <param name="index">Index of insertion</param>
 /// <returns></returns>
 public PageNode InsertPageNode(Page page, int index)
 {
     PageNode node = new PageNode(page);
     if (View.Pages.Count == 0)
     {
         Nodes.Add(node);
     }
     else
     {
         if (index == View.Pages.Count)
         {
             Nodes.Add(node);
         }
         else
         {
             Nodes.Insert(index, node);
         }
     }
     return node;
 }
Exemplo n.º 3
0
        /// <summary>
        /// Inserts a page node for a given page
        /// </summary>
        /// <param name="page">Page in which node is to be inserted</param>
        /// <param name="index">Index of insertion</param>
        /// <returns></returns>
        public PageNode InsertPageNode(Page page, int index)
        {
            PageNode node = new PageNode(page);

            if (View.Pages.Count == 0)
            {
                Nodes.Add(node);
            }
            else
            {
                if (index == View.Pages.Count)
                {
                    Nodes.Add(node);
                }
                else
                {
                    Nodes.Insert(index, node);
                }
            }
            return(node);
        }
Exemplo n.º 4
0
 /// <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);
     }
 }
Exemplo n.º 5
0
        void projectTree_MouseDown(object sender, System.Windows.Forms.MouseEventArgs e)
        {
            if (sender is TreeView)
            {
                Point point = new Point(e.X, e.Y);
                TreeNode node = ((TreeView)sender).GetNodeAt(point);

                if (node != null && node is PageNode)
                {
                    draggedPageNode = (PageNode)node;
                }
                if (node != null && node is TemplateNode)
                {
                    draggedTemplateNode = (TemplateNode)node;
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Deletes a page
        /// </summary>
        /// <param name="delNode">The page node</param>
        /// <param name="msg">Message to user to confirm deletion of page</param>
        private void DeletePage(PageNode delNode, string msg)
        {
            if (delNode.Parent.Nodes.Count != 1)
            {
                DialogResult result = MsgBox.Show(msg + " \n\n" + string.Format(SharedStrings.PAGE_NAME, delNode.Text), SharedStrings.MAKE_VIEW, MessageBoxButtons.YesNo);     //Epi.Windows.MsgBox.ShowQuestion(msg);
                if (result == DialogResult.Yes)
                {
                    mainForm.mediator.OnPageDeleteUpdateFieldQueue(delNode.Page);

                    ViewNode viewNode = (ViewNode)delNode.Parent;
                    int currentNodeIndex = delNode.Index;
                    viewNode.View.DeletePage(delNode.Page);
                    projectTree.Nodes.Remove(delNode);

                    if (currentNodeIndex == 0)
                    {
                        projectTree.SelectedNode = viewNode.Nodes[0];
                    }
                    else
                    {
                        projectTree.SelectedNode = viewNode.Nodes[currentNodeIndex - 1];
                    }
                }
            }
            else
            {
                MsgBox.ShowInformation(SharedStrings.WARNING_CANNOT_DELETE_PRIMARY_PAGE);
            }
        }