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); } } }
private void RemoveFromItemCache() { IStoreItemList itemCache = GetCache(); if (itemCache != null) { itemCache.Remove(this); } MaintainFilters(ChangeType.Removed); }
private void AddToItemCache() { IStoreItemList itemCache = GetCache(); if (itemCache != null) { itemCache.Add(this); } MaintainFilters(ChangeType.Added); }
private void ChildRemoved(StoreItem childItem) { IStoreItemList childItems = GetChildItems(); if (childItems != null && childItems.Contains(childItem)) { childItems.Remove(childItem); if (Planner.Instance.IsStartupComplete) { NotifyItemUpdatedWorker(new NotificationArgs(childItem, ChangeType.Removed, HierarchicalChangeSource.ChildItem, null)); } } }
private void RemoveOwnedItem(StoreItem ownedItem) { IStoreItemList ownedItems = GetOwnedItems(); if (ownedItems != null) { if (ownedItems.Contains(ownedItem)) { ownedItems.Remove(ownedItem); if (Planner.Instance.IsStartupComplete) { NotifyItemUpdatedWorker(new NotificationArgs(ownedItem, ChangeType.Removed, HierarchicalChangeSource.OwnedItem, null)); } } } }
private void NotifyItemUpdated(ItemProperty itemProperty) { if (Planner.Instance.IsStartupComplete) { NotificationArgs args = new NotificationArgs(this, ChangeType.Updated, HierarchicalChangeSource.ThisItem, itemProperty); NotifyItemUpdatedWorker(args); ItemPropertyChanged(args); // Also notify children that the parent has changed. IStoreItemList childItems = GetChildItems(); if (childItems != null) { args.ChangeSource = HierarchicalChangeSource.ParentItem; foreach (StoreItem childItem in childItems) { childItem.ItemPropertyChanged(args); } } } }