示例#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());
     }
 }