Ejemplo n.º 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);
                }
            }
        }
Ejemplo n.º 2
0
        private void RemoveFromItemCache()
        {
            IStoreItemList itemCache = GetCache();

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

            MaintainFilters(ChangeType.Removed);
        }
Ejemplo n.º 3
0
        private void AddToItemCache()
        {
            IStoreItemList itemCache = GetCache();

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

            MaintainFilters(ChangeType.Added);
        }
Ejemplo n.º 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));
                }
            }
        }
Ejemplo n.º 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));
                    }
                }
            }
        }
Ejemplo n.º 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);
                    }
                }
            }
        }