private void ChildAdded(StoreItem childItem) { IStoreItemList childItems = GetChildItems(); if (childItems == null) { return; } // If this child item isn't the type that this parent expects, // don't add it to the list of children. if (!childItems.ItemMatchesListType(childItem)) { Planner.OnInvalidHierarchicalItemEvent(this, childItem); return; } if (!childItems.Contains(childItem)) { childItems.Add(childItem); if (Planner.Instance.IsStartupComplete) { NotifyItemUpdatedWorker(new NotificationArgs(childItem, ChangeType.Added, HierarchicalChangeSource.ChildItem, null)); } if (StoreItem.IsRealItem(ParentItem)) { ParentItem.ChildAdded(this); } } }
//------------------------------------------------------------------------------------ /// <summary> /// Will be called when this item comes into existence and has been added to the /// global cache. /// </summary> //------------------------------------------------------------------------------------ public void OnAdd() { // Maintain item cache AddToItemCache(); // Maintain hierarchy if (StoreItem.IsRealItem(ParentItem)) { ParentItem.ChildAdded(this); } // Maintain owners if (StoreItem.IsRealItem(OwnerItem)) { OwnerItem.AddOwnedItem(this); } FinalizeItem(); }