This commit is contained in:
parent
edd5793f18
commit
1c9ef9e228
@ -338,20 +338,62 @@ namespace VEPROMS.CSLA.Library
|
|||||||
//if (Nodes.Count > 1)
|
//if (Nodes.Count > 1)
|
||||||
// Console.WriteLine("{0}, {1}",Nodes[0], Nodes[1]);
|
// Console.WriteLine("{0}, {1}",Nodes[0], Nodes[1]);
|
||||||
|
|
||||||
if (!myItemInfo.HasChildren && !(Nodes[0] is VETreeNode))
|
if (!myItemInfo.HasChildren && Nodes.Count>0 && !(Nodes[0] is VETreeNode))
|
||||||
Nodes.Clear();
|
Nodes.Clear();
|
||||||
}
|
}
|
||||||
void myItemInfo_NewChild(object sender, ItemInfoInsertEventArgs args)
|
void myItemInfo_NewChild(object sender, ItemInfoInsertEventArgs args)
|
||||||
{
|
{
|
||||||
|
if (args.ItemInserted.NextItem != null) // insert before
|
||||||
|
{
|
||||||
|
int nextItemID = args.ItemInserted.NextItem.ItemID;
|
||||||
|
VETreeNode nextNode = FindChildOrGrandChild(nextItemID);
|
||||||
|
nextNode.myItemInfo_NewSiblingBefore(sender, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (args.ItemInserted.MyPrevious != null) // insert after
|
||||||
|
{
|
||||||
|
int prevItemID = args.ItemInserted.MyPrevious.ItemID;
|
||||||
|
VETreeNode prevNode = FindChildOrGrandChild(prevItemID);
|
||||||
|
prevNode.myItemInfo_NewSiblingAfter(sender, args);
|
||||||
|
return;
|
||||||
|
}
|
||||||
bool isExpanded = IsExpanded;
|
bool isExpanded = IsExpanded;
|
||||||
// Restore the tree as it currently is expanded.
|
// Restore the tree as it currently is expanded.
|
||||||
Collapse();
|
Collapse();
|
||||||
Nodes.Clear();
|
Nodes.Clear();
|
||||||
_ChildrenLoaded = false;
|
_ChildrenLoaded = false;
|
||||||
ResetNode("Dummy myItemInfo_NewChild");
|
ResetNode("Dummy myItemInfo_NewChild");
|
||||||
//if (isExpanded) Expand();
|
ItemInfo item = VEObject as ItemInfo;
|
||||||
|
if (isExpanded && item != null && item.MyContent.ContentPartCount >1) // || args.ItemInserted.NextItem != null || args.ItemInserted.MyPrevious != null))
|
||||||
|
Expand();
|
||||||
|
else
|
||||||
Collapse();
|
Collapse();
|
||||||
}
|
}
|
||||||
|
private VETreeNode FindChildOrGrandChild(int itemID)
|
||||||
|
{
|
||||||
|
foreach (TreeNode childNode in Nodes)
|
||||||
|
{
|
||||||
|
VETreeNode child = childNode as VETreeNode;
|
||||||
|
if (child != null)
|
||||||
|
{
|
||||||
|
ItemInfo item = child.VEObject as ItemInfo;
|
||||||
|
if (item != null && item.ItemID == itemID)
|
||||||
|
return child;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
foreach (TreeNode childNode in Nodes)
|
||||||
|
{
|
||||||
|
VETreeNode child = childNode as VETreeNode;
|
||||||
|
if (child != null && child.VEObject is PartInfo)
|
||||||
|
foreach (VETreeNode grandchild in child.Nodes)
|
||||||
|
{
|
||||||
|
ItemInfo item = grandchild.VEObject as ItemInfo;
|
||||||
|
if (item != null && item.ItemID == itemID)
|
||||||
|
return grandchild;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
||||||
{
|
{
|
||||||
if(this.Parent != null) // Only do this if the node has a parent - RHM 20100106
|
if(this.Parent != null) // Only do this if the node has a parent - RHM 20100106
|
||||||
|
Loading…
x
Reference in New Issue
Block a user