Added Error Handling for VETreeNode so that a disconnected TreeNode will not cause the code to crash.

This commit is contained in:
Rich 2015-06-10 13:27:34 +00:00
parent cf585b9ea9
commit 8a8818f1fb

View File

@ -46,6 +46,7 @@ namespace VEPROMS.CSLA.Library
public class VETreeNode : TreeNode public class VETreeNode : TreeNode
{ {
#region Events #region Events
private static readonly log4net.ILog _MyLog = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
public event VETreeNodeEvent LoadingChildrenSQL; public event VETreeNodeEvent LoadingChildrenSQL;
public event VETreeNodeEvent LoadingChildrenMax; public event VETreeNodeEvent LoadingChildrenMax;
public event VETreeNodeEvent LoadingChildrenValue; public event VETreeNodeEvent LoadingChildrenValue;
@ -207,11 +208,15 @@ namespace VEPROMS.CSLA.Library
if (ol != null) if (ol != null)
{ {
OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count)); OnLoadingChildrenMax(this, new VETreeNodeEventArgs(ol.Count));
this.TreeView.BeginUpdate(); //this.TreeView.BeginUpdate();
if (this.TreeView != null) this.TreeView.BeginUpdate();
else _MyLog.WarnFormat("TreeView.BeginUpdate - Null");
ExpandChildren(ol); ExpandChildren(ol);
//} //}
//tNext("Set Nodes"); //tNext("Set Nodes");
this.TreeView.EndUpdate(); //this.TreeView.EndUpdate();
if (this.TreeView != null) this.TreeView.EndUpdate();
else _MyLog.WarnFormat("TreeView.EndUpdate - Null");
//tNext("End Update"); //tNext("End Update");
//tShowResults(); //tShowResults();
} }