Exemple #1
0
                private static BackgroundOperationResult OnCompleting(CollectBlocksOperation @this, Action <IBackgroundOperation> subOperationScheduler)
                {
                    @this._owner._blockCollectionHandlers[@this._handlerIndex].OnCompleted();

                    if (++@this._handlerIndex < @this._owner._blockCollectionHandlers.Count)
                    {
                        return(BackgroundOperationResult.NotCompleted);
                    }

                    @this._buffer.Clear();
                    return(BackgroundOperationResult.Completed);
                }
Exemple #2
0
                private static BackgroundOperationResult OnInitializing(CollectBlocksOperation @this, Action <IBackgroundOperation> subOperationScheduler)
                {
                    if (@this._owner._blockCollectionHandlers.Count == 0)
                    {
                        return(BackgroundOperationResult.Completed);
                    }

                    @this._buffer.Clear();
                    @this._owner._gridTerminalSystem.GetBlocksOfType(@this._buffer);

                    @this._handlerIndex = 0;

                    @this._state = OperationState.Starting;
                    return(BackgroundOperationResult.NotCompleted);
                }
Exemple #3
0
                private static BackgroundOperationResult OnStarting(CollectBlocksOperation @this, Action <IBackgroundOperation> subOperationScheduler)
                {
                    @this._owner._blockCollectionHandlers[@this._handlerIndex].OnStarting();

                    if (++@this._handlerIndex >= @this._owner._blockCollectionHandlers.Count)
                    {
                        @this._handlerIndex = 0;
                        @this._bufferIndex  = 0;
                        @this._previousCollectBlockOperation = null;
                        @this._state = (@this._buffer.Count == 0)
                            ? OperationState.Completing
                            : OperationState.Collecting;
                    }

                    return(BackgroundOperationResult.NotCompleted);
                }
Exemple #4
0
                private static BackgroundOperationResult OnCollecting(CollectBlocksOperation @this, Action <IBackgroundOperation> subOperationScheduler)
                {
                    if ((@this._previousCollectBlockOperation == null) || !@this._previousCollectBlockOperation.Result.IsSkipped)
                    {
                        @this._previousCollectBlockOperation = @this._owner._blockCollectionHandlers[@this._handlerIndex].MakeCollectBlockOperation(@this._buffer[@this._bufferIndex]);

                        subOperationScheduler.Invoke(@this._previousCollectBlockOperation);

                        if (++@this._handlerIndex < @this._owner._blockCollectionHandlers.Count)
                        {
                            return(BackgroundOperationResult.NotCompleted);
                        }
                    }
                    @this._handlerIndex = 0;
                    @this._previousCollectBlockOperation = null;

                    if (++@this._bufferIndex >= @this._buffer.Count)
                    {
                        @this._state = OperationState.Completing;
                    }

                    return(BackgroundOperationResult.NotCompleted);
                }