/// <summary>
        /// Update the observable result collections.
        /// </summary>
        /// <param name="result">The results of the completed load operation.</param>
        protected virtual void UpdateResults(DomainClientResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            // if the Entities property has been examined, update the backing
            // observable collection
            if (this._entities != null)
            {
                this._entitiesCollection.Clear();
                foreach (Entity entity in result.Entities)
                {
                    this._entitiesCollection.Add(entity);
                }
            }

            // if the AllEntities property has been examined, update the backing
            // observable collection
            if (this._allEntities != null)
            {
                this._allEntitiesCollection.Clear();
                foreach (Entity entity in result.AllEntities)
                {
                    this._allEntitiesCollection.Add(entity);
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Completes the invoke operation with the specified result.
        /// </summary>
        /// <param name="result">The result.</param>
        internal void Complete(DomainClientResult result)
        {
            object prevValue = this.Value;

            base.Complete(result);

            if (this.Result != null && this.Result.ReturnValue != prevValue)
            {
                this.RaisePropertyChanged("Value");
            }
        }
        /// <summary>
        /// Successfully completes the load operation with the specified result.
        /// </summary>
        /// <param name="result">The result.</param>
        internal void Complete(DomainClientResult result)
        {
            if (result == null)
            {
                throw new ArgumentNullException("result");
            }

            // before calling base, we need to update any cached
            // observable collection results so the correct data
            // is accessible in the completion callback
            if (result.Entities.Any())
            {
                this.UpdateResults(result);
            }

            base.Complete(result);

            // raise our property events after all base property
            // events have been raised
            if (result.Entities.Any())
            {
                this.RaisePropertyChanged("TotalEntityCount");
            }
        }