This commit is contained in:
parent
e3d76eb2e8
commit
1f71be0813
@ -76,7 +76,7 @@ namespace VEPROMS.CSLA.Library
|
|||||||
{
|
{
|
||||||
_VEObject = value;
|
_VEObject = value;
|
||||||
base.Text = _VEObject.ToString();
|
base.Text = _VEObject.ToString();
|
||||||
ResetNode();
|
ResetNode("Dummy Set_VEObject");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//public void Refresh()
|
//public void Refresh()
|
||||||
@ -110,12 +110,12 @@ namespace VEPROMS.CSLA.Library
|
|||||||
Console.WriteLine("Error: {0}", ex.Message);
|
Console.WriteLine("Error: {0}", ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public void ResetNode()
|
public void ResetNode(string dummy)
|
||||||
{
|
{
|
||||||
if (_VEObject!=null && _VEObject.HasChildren && _ChildrenLoaded == false)
|
if (_VEObject!=null && _VEObject.HasChildren && _ChildrenLoaded == false)
|
||||||
{
|
{
|
||||||
_ChildrenLoaded = false;// Reset the children loaded flag
|
_ChildrenLoaded = false;// Reset the children loaded flag
|
||||||
this.Nodes.Add("Dummy");// Add a Dummy Node so that the item will appear to be expanable.
|
this.Nodes.Add(dummy);// Add a Dummy Node so that the item will appear to be expanable.
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -131,14 +131,14 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
public void RefreshNode()
|
public void RefreshNode()
|
||||||
{
|
{
|
||||||
ResetNode();// Drop Children
|
ResetNode("Dummy RefreshNode");// Drop Children
|
||||||
LoadChildren();// Load Children
|
LoadChildren();// Load Children
|
||||||
}
|
}
|
||||||
public static VETreeNode GetFolder(int folderID)
|
public static VETreeNode GetFolder(int folderID)
|
||||||
{
|
{
|
||||||
VETreeNode tn = new VETreeNode(FolderInfo.Get(folderID));
|
VETreeNode tn = new VETreeNode(FolderInfo.Get(folderID));
|
||||||
//tn.Nodes.Add("Dummy");
|
//tn.Nodes.Add("Dummy");
|
||||||
tn.ResetNode();
|
tn.ResetNode("Dummy GetFolder");
|
||||||
return tn;
|
return tn;
|
||||||
}
|
}
|
||||||
// public abstract void LoadChildren();
|
// public abstract void LoadChildren();
|
||||||
@ -179,41 +179,20 @@ namespace VEPROMS.CSLA.Library
|
|||||||
this.Nodes.Clear();
|
this.Nodes.Clear();
|
||||||
//tReset();
|
//tReset();
|
||||||
DateTime tStart = DateTime.Now;
|
DateTime tStart = DateTime.Now;
|
||||||
|
//TVAddChildren(_VEObject, this);
|
||||||
OnLoadingChildrenSQL(this, new VETreeNodeEventArgs());
|
OnLoadingChildrenSQL(this, new VETreeNodeEventArgs());
|
||||||
IList ol;
|
IList ol;
|
||||||
if(_VEObject.GetType() == typeof(StepInfo) ||_VEObject.GetType() == typeof(SectionInfo) ||_VEObject.GetType() == typeof(ItemInfo) )
|
ItemInfo item = _VEObject as ItemInfo;
|
||||||
|
if (_VEObject.GetType() == typeof(StepInfo) || _VEObject.GetType() == typeof(SectionInfo) || _VEObject.GetType() == typeof(ItemInfo))
|
||||||
ol = ((ItemInfo)_VEObject).GetChildren(allParts);
|
ol = ((ItemInfo)_VEObject).GetChildren(allParts);
|
||||||
else
|
else
|
||||||
ol = _VEObject.GetChildren();
|
ol = _VEObject.GetChildren();
|
||||||
//tNext("GetChildren");
|
//tNext("GetChildren");
|
||||||
if (ol != null)
|
if (ol != null)
|
||||||
{
|
{
|
||||||
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
|
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
|
||||||
this.TreeView.BeginUpdate();
|
this.TreeView.BeginUpdate();
|
||||||
int icnt = 0;
|
ExpandChildren(ol);
|
||||||
foreach (IVEDrillDownReadOnly o in ol)
|
|
||||||
{
|
|
||||||
OnLoadingChildrenValue(this,new VETreeNodeEventArgs( ++icnt));
|
|
||||||
//tNext("Cycle");
|
|
||||||
try
|
|
||||||
{
|
|
||||||
VETreeNode tmp = new VETreeNode(o);
|
|
||||||
|
|
||||||
//tNext("Allocate VETreeNode");
|
|
||||||
//tmp.ResetNode();
|
|
||||||
if (o.HasChildren)
|
|
||||||
tmp.Nodes.Add("Dummy");// Add a Dummy Node so that the item will appear to be expanable.
|
|
||||||
else
|
|
||||||
tmp._ChildrenLoaded = true;// Reset the children loaded flag
|
|
||||||
//tNext("Add Children");
|
|
||||||
this.Nodes.Add(tmp);
|
|
||||||
//tNext("Add To Nodes");
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
//}
|
//}
|
||||||
//tNext("Set Nodes");
|
//tNext("Set Nodes");
|
||||||
this.TreeView.EndUpdate();
|
this.TreeView.EndUpdate();
|
||||||
@ -225,6 +204,78 @@ namespace VEPROMS.CSLA.Library
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void ExpandChildren(IList ol)
|
||||||
|
{
|
||||||
|
int icnt = 0;
|
||||||
|
foreach (IVEDrillDownReadOnly o in ol)
|
||||||
|
{
|
||||||
|
OnLoadingChildrenValue(this, new VETreeNodeEventArgs(++icnt));
|
||||||
|
//tNext("Cycle");
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VETreeNode tmp = new VETreeNode(o);
|
||||||
|
if (o.HasChildren)
|
||||||
|
{
|
||||||
|
if (o is PartInfo)
|
||||||
|
{
|
||||||
|
tmp.Nodes.Clear();
|
||||||
|
tmp.ExpandChildren(o.GetChildren());
|
||||||
|
tmp._ChildrenLoaded = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tmp.Nodes.Add(string.Format("dummy: {0}", o.GetType().Name));// Add a Dummy Node so that the item will appear to be expanable.
|
||||||
|
}
|
||||||
|
else
|
||||||
|
tmp._ChildrenLoaded = true;// Reset the children loaded flag
|
||||||
|
this.Nodes.Add(tmp);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private void TVAddChildren(IVEDrillDownReadOnly veobj, VETreeNode tn)
|
||||||
|
{
|
||||||
|
OnLoadingChildrenSQL(tn, new VETreeNodeEventArgs());
|
||||||
|
IList ol;
|
||||||
|
ItemInfo item = veobj as ItemInfo;
|
||||||
|
if (item != null && item.ItemID == 378)
|
||||||
|
Console.WriteLine("here");
|
||||||
|
if (veobj.GetType() == typeof(StepInfo) || veobj.GetType() == typeof(SectionInfo) || veobj.GetType() == typeof(ItemInfo))
|
||||||
|
ol = ((ItemInfo)veobj).GetChildren(true);
|
||||||
|
else
|
||||||
|
ol = veobj.GetChildren();
|
||||||
|
if (ol != null)
|
||||||
|
{
|
||||||
|
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
|
||||||
|
this.TreeView.BeginUpdate();
|
||||||
|
int icnt = 0;
|
||||||
|
foreach (IVEDrillDownReadOnly o in ol)
|
||||||
|
{
|
||||||
|
OnLoadingChildrenValue(this, new VETreeNodeEventArgs(++icnt));
|
||||||
|
try
|
||||||
|
{
|
||||||
|
VETreeNode tmp = new VETreeNode(o);
|
||||||
|
PartInfo pi = o as PartInfo;
|
||||||
|
if (pi == null && o.HasChildren)
|
||||||
|
tmp.Nodes.Add("Dummy");// Add a Dummy Node so that the item will appear to be expanable.
|
||||||
|
else
|
||||||
|
tmp._ChildrenLoaded = true;// Reset the children loaded flag
|
||||||
|
tn.Nodes.Add(tmp);
|
||||||
|
if (pi != null && o.HasChildren)
|
||||||
|
TVAddChildren(o, tmp);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine("{0}\r\n{1}", ex.Message, ex.InnerException);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//}
|
||||||
|
this.TreeView.EndUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
void myItemInfo_Deleted(object sender)
|
void myItemInfo_Deleted(object sender)
|
||||||
{
|
{
|
||||||
VETreeNode parnode = Parent as VETreeNode;
|
VETreeNode parnode = Parent as VETreeNode;
|
||||||
@ -267,20 +318,41 @@ namespace VEPROMS.CSLA.Library
|
|||||||
: base(o.ToString())
|
: base(o.ToString())
|
||||||
{
|
{
|
||||||
_VEObject = o;// Save the BusinessObject
|
_VEObject = o;// Save the BusinessObject
|
||||||
ResetNode();
|
ResetNode("Dummy VETreeNode(IVEDrillDownReadOnly o)");
|
||||||
ItemInfo myItemInfo = o as ItemInfo;
|
ItemInfo myItemInfo = o as ItemInfo;
|
||||||
if (myItemInfo != null)
|
if (myItemInfo != null)
|
||||||
{
|
{
|
||||||
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
myItemInfo.Deleted += new ItemInfoEvent(myItemInfo_Deleted);
|
||||||
myItemInfo.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
|
myItemInfo.MyContent.Changed += new ContentInfoEvent(MyContent_Changed);
|
||||||
|
myItemInfo.NewSiblingAfter += new ItemInfoInsertEvent(myItemInfo_NewSiblingAfter);
|
||||||
|
myItemInfo.NewSiblingBefore += new ItemInfoInsertEvent(myItemInfo_NewSiblingBefore);
|
||||||
|
myItemInfo.NewChild += new ItemInfoInsertEvent(myItemInfo_NewChild);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
void myItemInfo_NewChild(object sender, ItemInfoInsertEventArgs args)
|
||||||
|
{
|
||||||
|
bool isExpanded = IsExpanded;
|
||||||
|
// Restore the tree as it currently is expanded.
|
||||||
|
Collapse();
|
||||||
|
Nodes.Clear();
|
||||||
|
_ChildrenLoaded = false;
|
||||||
|
ResetNode("Dummy myItemInfo_NewChild");
|
||||||
|
if (isExpanded) Expand();
|
||||||
|
}
|
||||||
|
void myItemInfo_NewSiblingBefore(object sender, ItemInfoInsertEventArgs args)
|
||||||
|
{
|
||||||
|
this.Parent.Nodes.Insert(Index,(new VETreeNode(args.ItemInserted)));
|
||||||
|
}
|
||||||
|
void myItemInfo_NewSiblingAfter(object sender, ItemInfoInsertEventArgs args)
|
||||||
|
{
|
||||||
|
this.Parent.Nodes.Insert(Index+1, (new VETreeNode(args.ItemInserted)));
|
||||||
|
}
|
||||||
void MyContent_Changed(object sender)
|
void MyContent_Changed(object sender)
|
||||||
{
|
{
|
||||||
|
ContentInfo myContent = sender as ContentInfo;
|
||||||
|
ItemInfo myItemInfo = myContent.ContentItems[0];
|
||||||
Text = _VEObject.ToString();
|
Text = _VEObject.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public VETreeNode(string s)
|
public VETreeNode(string s)
|
||||||
: base(s)
|
: base(s)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user