public virtual object GetSPObject() { object result = null; // This ensures that a chain of objects are created if (Parent.SPObject == null) { return(result); } if (ParentPropertyDescriptor == null) { return(result); } try { result = ParentPropertyDescriptor.GetValue(Parent.SPObject); } catch { // Sometimes its not possible to get the object at this point. } return(result); }
public virtual void Setup(ISPNode parent) { if (parent == null) { return; } Parent = parent; NodeProvider = parent.NodeProvider; if (ParentPropertyDescriptor == null) { ParentPropertyDescriptor = new NullPropertyDescriptor(parent); } if (String.IsNullOrEmpty(ID)) { if (parent is ISPNodeCollection && SPObject != null) { ID = GetCollectionItemID(SPObject, Index); } else { ID = ParentPropertyDescriptor.GetHashCode().ToString(); } } var tempText = GetTitle(); Text = tempText; //ToolTipText = tempText; // Make sure to update all children if exist! foreach (var item in Children) { item.Setup(this); if (item.Children.Count > 0) { item.LoadChildren(); } } }