コード例 #1
0
        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);
                }
            }
        }
コード例 #2
0
        private void RemoveFromItemCache()
        {
            IStoreItemList itemCache = GetCache();

            if (itemCache != null)
            {
                itemCache.Remove(this);
            }

            MaintainFilters(ChangeType.Removed);
        }
コード例 #3
0
        private void AddToItemCache()
        {
            IStoreItemList itemCache = GetCache();

            if (itemCache != null)
            {
                itemCache.Add(this);
            }

            MaintainFilters(ChangeType.Added);
        }
コード例 #4
0
        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));
                }
            }
        }
コード例 #5
0
        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));
                    }
                }
            }
        }
コード例 #6
0
        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);
                    }
                }
            }
        }