示例#1
0
 private void toolStripMenuItemNewBranch(object sender, EventArgs e)
 {
     try
     {
         // show dialog
         FormCreateBranch dlg = new FormCreateBranch();
         if (DialogResult.OK == dlg.ShowDialog())
         {
             Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
             // get parent node
             Pic.DAL.SQLite.TreeNode parentNode = Pic.DAL.SQLite.TreeNode.GetById(db, _treeNodeId);
             // create new branch
             Pic.DAL.SQLite.TreeNode nodeNew = parentNode.CreateChild(db, dlg.BranchName, dlg.BranchDescription, dlg.BranchImage);
             // redraw branch
             ShowBranch(_treeNodeId);
             // event
             if (null != TreeNodeCreated)
             {
                 TreeNodeCreated(this, new NodeEventArgs(nodeNew.ID, NodeTag.NodeType.NT_TREENODE));
             }
         }
     }
     catch (System.Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
示例#2
0
 private void OnTSMenuItemNewBranch(object sender, EventArgs e)
 {
     try
     {
         // show dialog
         FormCreateBranch dlg = new FormCreateBranch();
         if (DialogResult.OK == dlg.ShowDialog())
         {
             Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
             // get parent node
             Pic.DAL.SQLite.TreeNode parentNode = Pic.DAL.SQLite.TreeNode.GetById(db, CurrentNodeTag.TreeNode);
             // create new branch
             Pic.DAL.SQLite.TreeNode nodeNew = parentNode.CreateChild(db, dlg.BranchName, dlg.BranchDescription, dlg.BranchImage);
             // redraw branch
             ShowBranch(CurrentNodeTag);
             // event
             TreeNodeCreated?.Invoke(this, new NodeEventArgs(nodeNew.ID, NodeTag.NType.NTBranch));
         }
     }
     catch (Exception ex)
     {
         _log.Error(ex.ToString());
     }
 }
 private void toolStripMenuItemNewBranch(object sender, EventArgs e)
 {
     try
     {
         // show dialog
         FormCreateBranch dlg = new FormCreateBranch();
         if (DialogResult.OK == dlg.ShowDialog())
         {
             Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
             // get parent node
             Pic.DAL.SQLite.TreeNode parentNode = Pic.DAL.SQLite.TreeNode.GetById(db, _treeNodeId);
             // create new branch
             Pic.DAL.SQLite.TreeNode nodeNew = parentNode.CreateChild(db, dlg.BranchName, dlg.BranchDescription, dlg.BranchImage);
             // redraw branch
             ShowBranch(_treeNodeId);
             // event
             if (null != TreeNodeCreated)
                 TreeNodeCreated(this, new NodeEventArgs(nodeNew.ID, NodeTag.NodeType.NT_TREENODE));
         }
     }
     catch (System.Exception ex)
     {
         _log.Error(ex.ToString());
     } 
 }
示例#4
0
 public void AskRootNode()
 {
     FormCreateBranch form = new FormCreateBranch();
     if (DialogResult.OK == form.ShowDialog())
     {
         Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
         Pic.DAL.SQLite.TreeNode.CreateNew(db, form.BranchName, form.BranchDescription, form.BranchImage);
     }
 }
示例#5
0
 private void insertNewBranchLabel_Click(object sender, EventArgs e)
 {
     try
     {
         // get current tree node
         NodeTag tag = GetCurrentTag();
         if (null == tag || tag.IsDocument)
             throw new Exception("Invalid branch tag");
         // show dialog
         FormCreateBranch dlg = new FormCreateBranch();
         if (DialogResult.OK == dlg.ShowDialog())
         {
             Pic.DAL.SQLite.PPDataContext db = new Pic.DAL.SQLite.PPDataContext();
             // get parent node
             Pic.DAL.SQLite.TreeNode parentNode = Pic.DAL.SQLite.TreeNode.GetById(db, tag.TreeNode);
             // create new branch
             Pic.DAL.SQLite.TreeNode nodeNew = parentNode.CreateChild(db, dlg.BranchName, dlg.BranchDescription, dlg.BranchImage);
             // insert branch node
             InsertTreeNode(SelectedNode, nodeNew);
             // select current node
             SelectedNode = FindNode(null, tag);
         }
     }
     catch (System.Exception ex)
     {
         Debug.Fail(ex.ToString());
         _log.Debug(ex.ToString());
     }
 }