public void UpdateKeys(ViewKeyCollection keys) { if (keys == null) { throw new ArgumentNullException("keys"); } m_data.Keys = keys; m_data.LastUpdated = DateTime.Now(); }
public static ViewKeyCollection FromQueryResult(ItemQueryResult queryResult) { ViewKeyCollection keys = new ViewKeyCollection(); if (queryResult != null) { if (queryResult.HasItems) { keys.AddFromItems(queryResult.Items); } if (queryResult.HasPending) { keys.AddFromPendingItems(queryResult.PendingItems); } } return(keys); }
internal async Task SynchronizeAsyncImpl(CancellationToken cancelToken) { if (!m_data.HasQuery) { throw new ArgumentException("Query"); } ItemQuery query = m_data.Query; int maxResults = (query.MaxResults) != null ? m_data.Query.MaxResults.Value : 0; IList <PendingItem> pendingItems = await Record.GetKeysAndDateAsync(query.Filters, maxResults).AsTask(cancelToken); ViewKeyCollection newKeys = new ViewKeyCollection(); if (!pendingItems.IsNullOrEmpty()) { newKeys.AddFromPendingItems(pendingItems); } this.UpdateKeys(newKeys); }
async Task UpdateKeys(ISynchronizedView view, ItemQueryResult queryResult) { ViewKeyCollection keys = null; if (queryResult != null) { keys = ViewKeyCollection.FromQueryResult(queryResult); } else { keys = new ViewKeyCollection(); } view.UpdateKeys(keys); SynchronizedType sType = view as SynchronizedType; if (sType != null) { await sType.SaveAsync(); } }
public void UpdateKeys(ViewKeyCollection keys) { m_items.UpdateKeys(keys); }