Ejemplo n.º 1
0
        private bool AddCheck()
        {
            DataVerifier dv = new DataVerifier();

            dv.Check(selectedNode == null && index > 1, "请按照 一级标题->二级标题->三级标题->四级标题 的顺序添加!");
            if (selectedNode != null)
            {
                int pindex = stitle.ToList().FindIndex(a => ((Title)selectedNode.Tag).TContent.ConType == a);
                dv.CheckIfBeforePass(pindex == 0 && index != 0, "请非正文后面添加下级标题!");
                dv.CheckIfBeforePass(index != 0 && pindex != 0 && index != pindex + 1, "请按照 一级标题->二级标题->三级标题->四级标题 的顺序添加!");
            }

            dv.ShowMsgIfFailed();
            return(dv.Pass);
        }
Ejemplo n.º 2
0
        private bool DelCheck()
        {
            DataVerifier dv = new DataVerifier();

            dv.Check(selectedNode == null, "请选择要删除的节点");
            if (selectedNode != null)
            {
                if (selectedNode.Nodes.Count > 0)
                {
                    var child  = selectedNode.Nodes[0];
                    int sindex = stitle.ToList().FindIndex(a => ((Title)selectedNode.Tag).TContent.ConType == a);
                    if (child != null)
                    {
                        int cindex = stitle.ToList().FindIndex(a => ((Title)child.Tag).TContent.ConType == a);
                        dv.CheckIfBeforePass(sindex > 0 && cindex > 0, "请按照 一级标题->二级标题->三级标题->四级标题 的顺序");
                    }
                }
            }

            dv.ShowMsgIfFailed();
            return(dv.Pass);
        }