Esempio n. 1
0
        //------------------------------------------------------------------------------------
        /// <summary>
        ///  Updates the change list based upon the current state of the given item.
        /// </summary>
        //------------------------------------------------------------------------------------
        public void UpdateChangeList(StoreItem item)
        {
            // Changes for items in immediate save mode are being batched for a direct save
            // operation, and don't go on the changelist.
            if (item.IsInImmediateSave)
            {
                return;
            }

            bool isDirty = item.IsDirty;

            if (!m_changedItems.Contains(item))
            {
                if (isDirty)
                {
                    m_changedItems.Add(item);
                    Planner.OnChangeListUpdated(this, new ChangeListUpdatedEventArgs(m_changedItems.Count));
                }
            }
            else
            {
                if (!isDirty)
                {
                    m_changedItems.Remove(item);
                    Planner.OnChangeListUpdated(this, new ChangeListUpdatedEventArgs(m_changedItems.Count));
                }
            }
        }
        // Check for duplicate items (items with same name) in edm item collection and store item collection. Mapping is the only logical place to do this.
        // The only other place is workspace, but that is at the time of registering item collections (only when the second one gets registered) and we
        // will have to throw exceptions at that time. If we do this check in mapping, we might throw error in a more consistent way (by adding it to error
        // collection). Also if someone is just creating item collection, and not registering it with workspace (tools), doing it in mapping makes more sense
        private static void CheckForDuplicateItems(EdmItemCollection edmItemCollection, StoreItemCollection storeItemCollection, List <EdmSchemaError> errorCollection)
        {
            Debug.Assert(edmItemCollection != null && storeItemCollection != null && errorCollection != null, "The parameters must not be null in CheckForDuplicateItems");

            foreach (GlobalItem item in edmItemCollection)
            {
                if (storeItemCollection.Contains(item.Identity))
                {
                    errorCollection.Add(new EdmSchemaError(Strings.Mapping_ItemWithSameNameExistsBothInCSpaceAndSSpace(item.Identity),
                                                           (int)StorageMappingErrorCode.ItemWithSameNameExistsBothInCSpaceAndSSpace, EdmSchemaErrorSeverity.Error));
                }
            }
        }
        private void BuildBacklogItems()
        {
            m_backlogItems       = new StoreItemCollection <BacklogItem>();
            m_activeBacklogItems = new StoreItemCollection <BacklogItem>();
            foreach (WorkItem workItem in m_workItems)
            {
                BacklogItem backlogItem = workItem.ParentBacklogItem;
                if (backlogItem != null)
                {
                    if (!m_backlogItems.Contains(backlogItem))
                    {
                        m_backlogItems.Add(backlogItem);

                        if (backlogItem.IsActive)
                        {
                            m_activeBacklogItems.Add(backlogItem);
                        }
                    }
                }
            }
        }