private void DragToBox(DragEventArgs e, TreeNodeBox b) { if (true == TryDragDisk(e, b)) { return; } }
private bool TryDragDisk(DragEventArgs e, TreeNodeBox b) { object fromObj = e.Data.GetData(typeof (TreeNodeDisk)); if (null == fromObj) { return false; } if (fromObj == b) { return false; } TreeNodeDisk dragedDisk = (TreeNodeDisk) fromObj; dragedDisk.InternalDisk.Box = b.InternalBox; return true; }
/// <summary> /// Causes tree node to get its child nodes /// </summary> public override void LoadTreeNodeChilds() { if (true == this.nodesLoaded) { return; } if (true == this.cat.IsRoot) { this.trv.Nodes.Clear(); } else { this.Nodes.Clear(); } var lst = this.cat.ChildCategories; if (null != lst) { foreach (DataBase.Category c in lst) { if (false == c.IsDeleted) { TreeNodeCategory cc = new TreeNodeCategory(this.db, c, this.trv); if (true == this.cat.IsRoot) { this.trv.Nodes.Add(cc); } else { this.Nodes.Add(cc); } } } } var childBoxes = this.cat.ChildCDBoxes; if (null != lst) { foreach (DataBase.Box r in childBoxes) { if (false == r.IsDeleted) { TreeNodeBox b = new TreeNodeBox(this.db, r, this.trv); if (true == this.cat.IsRoot) { this.trv.Nodes.Add(b); } else { this.Nodes.Add(b); } } } } this.nodesLoaded = true; }