Exemplo n.º 1
0
        private void ProcessUnreadCountedLinksChange(IResource res, IPropertyChangeSet cs)
        {
            UnreadState[] unreadStates = GetResourceUnreadStates(res);

            int[] propIDs = cs.GetChangedProperties();
            for (int i = 0; i < propIDs.Length; i++)
            {
                int propID = propIDs [i];
                if (_store.PropTypes [propID].HasFlag(PropTypeFlags.CountUnread))
                {
                    foreach (LinkChange change in cs.GetLinkChanges(propID))
                    {
                        IResource target = _store.TryLoadResource(change.TargetId);
                        if (target == null)
                        {
                            continue;
                        }

                        int delta = (change.ChangeType == LinkChangeType.Add) ? 1 : -1;

                        foreach (UnreadState state in unreadStates)
                        {
                            AdjustUnreadCount(target, delta, state);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        /**
         * Returns the list of all link types for the given resource. If the resource
         * was changed, the list also includes the link types which were present on
         * the resource before the change.
         */

        private IntArrayList GetAllLinkTypes(IResource res, IPropertyChangeSet cs)
        {
            IntArrayList linkTypeIDs = new IntArrayList(res.GetLinkTypeIds());

            if (cs != null)
            {
                int[] changedPropIDs = cs.GetChangedProperties();
                for (int i = 0; i < changedPropIDs.Length; i++)
                {
                    int propID = changedPropIDs [i];
                    if (_store.PropTypes [propID].DataType == PropDataType.Link && linkTypeIDs.IndexOf(propID) < 0)
                    {
                        linkTypeIDs.Add(propID);
                    }
                }
            }
            return(linkTypeIDs);
        }