示例#1
0
        /// <summary>
        /// Sets up the batch provider for the specified recipe
        /// </summary>
        /// <param name="recipe">The recipe the provider must evaluate</param>
        /// <param name="isMain">Indicates whether this is the top level collection,
        /// otherwise a sub collection of a heterogeneous collection</param>
        /// <param name="source">The source that requested evaluated of the recipe</param>
        /// <param name="batchSize">The batch size</param>
        private Task SetupBatchProviderFor(FeatureCollectionRecipe recipe, bool isMain = true, object source = null, int batchSize = -1)
        {
            // Get the default batch size happening
            if (batchSize == -1)
            {
                batchSize = this.BatchSize;
            }

            // Set up the batch provider for the specified recipe
            BatchProvider = new FeatureCollectionBatchProvider(_featureCollectionRecipe, this.BatchSize)
            {
                // The source that activated this evaluation
                Source = source,

                // Indicates whether this is a top-level collection or a sub collection
                // of a heterogeneous collection
                IsMain = isMain,

                // Set the logger of the batch provider
                Logger = Logger
            };

            // Return the task that takes care of refreshing the current batch
            // This can be awaited by the consumer
            return(BatchProvider.RefreshCurrentBatch());
        }
示例#2
0
        /// <summary>
        /// Setup the contents of this list view using the specified collection.
        /// The specified source is the viewModel that originated the display of the collection.
        /// </summary>
        private Task SetupForCollection(FeatureCollection collection, object source, bool isMain = true)
        {
            _featureCollection       = collection;
            _featureCollectionRecipe = _featureCollection != null ? _featureCollection.CollectionRecipe : null;

            if (!SettingFeatureCollectionFromHistoryOrSub && _featureCollection != null)
            {
                this.History.Add(_featureCollection);
            }

            // Only handle recipes that actually have a result table descriptor
            if (_featureCollectionRecipe == null)
            {
                // There is no spoon - do nothing, though we could choose to empty things
                // GridViewModel.FeatureCollection = null;
            }
            else
            {
                // Do batch wise
                return(SetupBatchProviderFor(_featureCollectionRecipe, isMain, source));
            }

            // Return a simple task (use the Boolean generic task subclass - these are automatically cached and reused)
            return(TaskEx.FromResult(true));
        }