// Get ids of items that changed for a given type ID public IAsyncOperation <IList <string> > GetIDsOfChangedItemsForTypeAsync(string typeID) { if (string.IsNullOrEmpty(typeID)) { throw new ArgumentException("typeID"); } return(AsyncInfo.Run(async cancelToken => { List <string> ids = new List <string>(); using (await CrossThreadLockScope.Enter(m_lock)) { await this.EnsureIndexAsync(); foreach (string itemID in m_itemIDIndex) { RecordItemChange change = await this.GetChangeAsync(itemID); if (change != null && change.IsChangeForType(typeID)) { ids.Add(itemID); } } return (IList <string>)ids; } })); }
// Are there any changes for the given type ID? public IAsyncOperation <bool> HasChangesForTypeAsync(string typeID) { if (string.IsNullOrEmpty(typeID)) { throw new ArgumentException("typeID"); } return(AsyncInfo.Run(async cancelToken => { using (await CrossThreadLockScope.Enter(m_lock)) { await this.EnsureIndexAsync(); foreach (string itemID in m_itemIDIndex) { RecordItemChange change = await this.GetChangeAsync(itemID); if (change != null && change.IsChangeForType(typeID)) { return true; } } return false; } })); }
// Remove all pending changes for a given type ID public IAsyncAction RemoveAllChangesForTypeAsync(string typeID) { if (string.IsNullOrEmpty(typeID)) { throw new ArgumentException("typeID"); } return(AsyncInfo.Run(async cancelToken => { using (await CrossThreadLockScope.Enter(m_lock)) { await this.EnsureIndexAsync(); string[] allIDs = m_itemIDIndex.ToArray(); foreach (string itemID in allIDs) { RecordItemChange change = await this.GetChangeAsync(itemID); if (change != null && change.IsChangeForType(typeID)) { await this.DeleteChangeAsync(itemID); } } } })); }