/// <summary> /// Perform a deep copy of this metadata collection. /// </summary> /// <returns> /// Returns a deep copy of this metadata collection. /// </returns> public IGalleryObjectMetadataItemCollection Copy() { IGalleryObjectMetadataItemCollection metaDataItemCollectionCopy = new GalleryObjectMetadataItemCollection(); foreach (IGalleryObjectMetadataItem metaDataItem in this.Items) { metaDataItemCollectionCopy.Add(metaDataItem.Copy()); } return(metaDataItemCollectionCopy); }
/// <summary> /// Gets the items in the collection that are visible to the UI. That is, get the items where <see cref="IGalleryObjectMetadataItem.IsVisible" /> /// = <c>true</c>. /// </summary> /// <returns>Returns a list of items that are visible to the UI.</returns> public IGalleryObjectMetadataItemCollection GetVisibleItems() { // We know galleryObjectMetadataItems is actually a List<IGalleryObjectMetadataItem> because we passed it to the constructor. List <IGalleryObjectMetadataItem> galleryObjectMetadataItems = (List <IGalleryObjectMetadataItem>)Items; IGalleryObjectMetadataItemCollection metadataItemsCollection = new GalleryObjectMetadataItemCollection(); galleryObjectMetadataItems.ForEach(delegate(IGalleryObjectMetadataItem metaItem) { if (metaItem.IsVisible) { metadataItemsCollection.Add(metaItem); } }); return(metadataItemsCollection); }
/// <summary> /// Get a list of items whose metadata must be persisted to the data store, either because it has been added or because /// it has been modified. All IGalleryObjectMetadataItem whose HasChanges property are true are returned. This is called during a /// save operation to indicate which metadata items must be saved. Guaranteed to not return null. If no items /// are found, an empty collection is returned. /// </summary> /// <returns> /// Returns a list of items whose metadata must be updated with the metadata currently in the media object's file. /// </returns> public IGalleryObjectMetadataItemCollection GetItemsToSave() { // We know galleryObjectMetadataItems is actually a List<IGalleryObjectMetadataItem> because we passed it to the constructor. System.Collections.Generic.List <IGalleryObjectMetadataItem> galleryObjectMetadataItems = (System.Collections.Generic.List <IGalleryObjectMetadataItem>)Items; IGalleryObjectMetadataItemCollection metadataItemsCollection = new GalleryObjectMetadataItemCollection(); galleryObjectMetadataItems.ForEach(delegate(IGalleryObjectMetadataItem metaItem) { if (metaItem.HasChanges) { metadataItemsCollection.Add(metaItem); } }); return(metadataItemsCollection); }