예제 #1
0
        /// <summary>
        /// Called when the underlying query changes.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="args">The arguments.</param>
        private void OnChanged(object sender, QueryChangeEventArgs args)
        {
            // $todo(jeff.lill):
            //
            // For now, I'm simply going to update the entire collection.  In the future,
            // it may be possible to compare the current collection with the new query
            // results to try to minimize the changes.   This could result in a better
            // user experience.

            rowList.Clear();

            foreach (var row in liveQuery.Rows)
            {
                var entityRow = new EntityQueryRow <TEntity>(row);

                if (postFilter != null && !postFilter(entityRow))
                {
                    continue;
                }

                rowList.Add(entityRow);
            }

            CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
        }
예제 #2
0
        /// <inheritdoc/>
        IEnumerator IEnumerable.GetEnumerator()
        {
            foreach (var row in Base)
            {
                var entityRow = new EntityQueryRow <TEntity>(row);

                if (postFilter != null && !postFilter(entityRow))
                {
                    continue;
                }

                yield return(entityRow);
            }
        }
예제 #3
0
 /// <inheritdoc/>
 public bool Remove(EntityQueryRow <TEntity> item)
 {
     throw new InvalidOperationException(ReadOnlyError);
 }
예제 #4
0
 /// <inheritdoc/>
 public bool Contains(EntityQueryRow <TEntity> item)
 {
     return(rowList.Contains(item));
 }
예제 #5
0
 /// <inheritdoc/>
 public void Add(EntityQueryRow <TEntity> item)
 {
     throw new InvalidOperationException(ReadOnlyError);
 }
예제 #6
0
 /// <inheritdoc/>
 public void Insert(int index, EntityQueryRow <TEntity> item)
 {
     throw new InvalidOperationException(ReadOnlyError);
 }
예제 #7
0
 /// <inheritdoc/>
 public int IndexOf(EntityQueryRow <TEntity> item)
 {
     return(rowList.IndexOf(item));
 }