예제 #1
0
파일: UnreadManager.cs 프로젝트: mo5h/omeo
        private void OnResourceSaved(object sender, ResourcePropEventArgs e)
        {
            if (e.ChangeSet.IsPropertyChanged(_coreProps.IsUnread) || e.ChangeSet.IsPropertyChanged(_coreProps.IsDeleted))
            {
                bool wasUnread = e.ChangeSet.GetOldValue(_coreProps.IsUnread) != null ||
                                 (!e.ChangeSet.IsPropertyChanged(_coreProps.IsUnread) && e.Resource.HasProp(_coreProps.IsUnread));
                bool wasDeleted = e.ChangeSet.GetOldValue(_coreProps.IsDeleted) != null ||
                                  (!e.ChangeSet.IsPropertyChanged(_coreProps.IsDeleted) && e.Resource.HasProp(_coreProps.IsDeleted));
                bool isUnread  = e.Resource.HasProp(_coreProps.IsUnread);
                bool isDeleted = e.Resource.HasProp(_coreProps.IsDeleted);

                int oldUnreadStatus = (wasUnread && !wasDeleted) ? 1 : 0;
                int newUnreadStatus = (isUnread && !isDeleted) ? 1 : 0;

                if (oldUnreadStatus != newUnreadStatus)
                {
                    ProcessResourceUnreadChange(e.Resource, newUnreadStatus - oldUnreadStatus,
                                                (newUnreadStatus > oldUnreadStatus) ? null : e.ChangeSet);
                }
            }
            else if (e.Resource.HasProp(_coreProps.IsUnread) && !e.Resource.HasProp(_coreProps.IsDeleted))
            {
                ProcessUnreadCountedLinksChange(e.Resource, e.ChangeSet);
                if (e.ChangeSet.IsPropertyChanged(_workspaceManager.Props.WorkspaceVisible))
                {
                    ProcessWorkspaceChange(e.Resource, e.ChangeSet);
                }
            }
        }
예제 #2
0
 private void HandleLinkedResourceChanged(object sender, ResourcePropEventArgs e)
 {
     if (e.Resource.HasProp(Core.Props.IsDeleted))
     {
         Core.UIManager.QueueUIJob(new MethodInvoker(UpdateLinksPane));
     }
 }
예제 #3
0
        private void ResourceStore_OnResourceSaved(object sender, ResourcePropEventArgs e)
        {
            if (Props.WorkspaceVisible != 0 && e.Resource.HasProp(Props.WorkspaceVisible) && e.Resource.Type != _props.WorkspaceResourceType)
            {
                IResourceList wsList = null;

                int recurseLinkProp = GetRecurseLinkPropId(e.Resource.Type);
                if (e.ChangeSet.IsPropertyChanged(-recurseLinkProp))
                {
                    if (wsList == null)
                    {
                        wsList = e.Resource.GetLinksOfType(null, Props.WorkspaceVisible);
                    }
                    foreach (IResource ws in wsList)
                    {
                        if (IsInWorkspaceRecursive(ws, e.Resource))
                        {
                            LinkChange[] linkChanges = e.ChangeSet.GetLinkChanges(-recurseLinkProp);
                            ProcessWorkspaceLinkChanges(ws, linkChanges);
                        }
                    }
                }

                WorkspaceTypeRec wrType = (WorkspaceTypeRec)_resTypeToWorkspaceRec [e.Resource.Type];
                if (wrType != null)
                {
                    foreach (int linkPropId in wrType._linkPropIds)
                    {
                        if (e.ChangeSet.IsPropertyChanged(linkPropId))
                        {
                            if (wsList == null)
                            {
                                wsList = e.Resource.GetLinksOfType(null, Props.WorkspaceVisible);
                            }
                            LinkChange[] linkChanges = e.ChangeSet.GetLinkChanges(linkPropId);
                            foreach (IResource workspace in wsList)
                            {
                                ProcessWorkspaceLinkChanges(workspace, linkChanges);
                            }
                        }
                    }
                }
            }
        }
예제 #4
0
        private void OnResourceSaved(object sender, ResourcePropEventArgs e)
        {
            IResourceList resList = _resourceList;

            if (resList != null && resList.Count == 1 && e.Resource.Id == resList.ResourceIds [0])
            {
                int[] changedPropIDs = e.ChangeSet.GetChangedProperties();
                for (int i = 0; i < changedPropIDs.Length; i++)
                {
                    int propId = changedPropIDs [i];
                    if (Core.ResourceStore.PropTypes [propId].DataType == PropDataType.Link ||
                        ResourceTypeHelper.IsCustomPropType(propId))
                    {
                        Core.UIManager.QueueUIJob(new MethodInvoker(UpdateLinksPane));
                        break;
                    }
                }
            }
        }