Beispiel #1
0
        private void 设置为默认笔记本ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNodeTag treenodenotebooktag = treeview_nav.SelectedNode.Tag as TreeNodeTag;
            int         nodeno = treenodenotebooktag.no;

            Controller.Notebook notebookno = new Controller.Notebook();
            notebookno.setDefault(nodeno);
            treeview_nav.Nodes.Clear();
            this.Load_treeview();
        }
Beispiel #2
0
        //删除笔记本
        private void  除ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MessageBoxButtons messButton = MessageBoxButtons.OKCancel;
            DialogResult      dr         = MessageBox.Show("删除笔记本将会同时删除笔记本内所有笔记,确认删除?", "删除笔记本", messButton);

            if (dr == DialogResult.OK)//如果点击“确定”按钮
            {
                //创建tag对象
                TreeNodeTag treenodenotebooktag = treeview_nav.SelectedNode.Tag as TreeNodeTag;
                //取值
                string nodename = treenodenotebooktag.name;
                int    nodeno   = treenodenotebooktag.no;
                //用控制器删掉
                Controller.Notebook notebookno = new Controller.Notebook();
                notebookno.deleteNotebook(nodeno);
                //刷新
                treeview_nav.Nodes.Clear();
                this.Load_treeview();
            }
            else//如果点击“取消”按钮
            {
            }
        }
Beispiel #3
0
        private void treeview_nav_AfterLabelEdit(object sender, NodeLabelEditEventArgs e)
        {
            string newtext = e.Label;     //获取新文本
            string oldtext = e.Node.Text; //获取原来的文本

            newtext = oldtext;
            if (newtext != oldtext)
            {
                Console.WriteLine("不一样");
                TreeNodeTag treenodenotebooktag = treeview_nav.SelectedNode.Tag as TreeNodeTag;
                //获得节点信息
                string nodename = treenodenotebooktag.name;
                int    nodeno   = treenodenotebooktag.no;
                //判断类型
                string nodetype = treenodenotebooktag.node_type;
                if (nodetype == "notebook")
                {
                    Controller.Notebook notebookno = new Controller.Notebook();
                    notebookno.renameNotebook(nodeno, newtext);
                }
                else if (nodetype == "label")
                {
                    Controller.Label label = new Controller.Label();
                    label.renameLabel(nodeno, newtext);
                }
                //刷新
                treeview_nav.Nodes.Clear();
                this.Load_treeview();
                treeview_nav.LabelEdit = false;
            }
            else
            {
                Console.WriteLine("一样的");
                treeview_nav.LabelEdit = false;
            }
        }