Ejemplo n.º 1
0
        protected virtual void ImportHandHistoriesUsing(IHandHistoryRetriever handHistoryRetriever)
        {
            PrepareToImportHandHistoriesUsing(handHistoryRetriever);

            _backgroundWorker.DoWork += (s, e) => {
                if (_numberOfHandsToImport > 0)
                {
                    while (!handHistoryRetriever.IsDone)
                    {
                        ImportNextBatchOfHandHistoriesUsing(handHistoryRetriever);
                    }
                }
            };
            _backgroundWorker.RunWorkerCompleted += (s, e) => FinishedImportingHandHistories();

            _backgroundWorker.RunWorkerAsync();
        }
Ejemplo n.º 2
0
        protected void ImportNextBatchOfHandHistoriesUsing(IHandHistoryRetriever handHistoryRetriever)
        {
            var nextBatchOfHandHistories =
                handHistoryRetriever
                .GetNext(BatchSize)
                .Aggregate(string.Empty, (collectedSoFar, currentHandHistory) => collectedSoFar + "\n\n" + currentHandHistory);

            _numberOfHandsAttemptedToImport += BatchSize;

            var convertedHands =
                _repository
                .RetrieveHandsFromString(nextBatchOfHandHistories);

            _repository.InsertHands(convertedHands);

            _numberOfHandsSuccessfullyImported += convertedHands.Count();

            ReportProgress(_numberOfHandsAttemptedToImport * 100 / _numberOfHandsToImport);
        }
Ejemplo n.º 3
0
 protected void PrepareToImportHandHistoriesUsing(IHandHistoryRetriever handHistoryRetriever)
 {
     _numberOfHandsToImport = handHistoryRetriever.HandHistoriesCount;
     ReportProgress(0);
     IsBusy = true;
 }
Ejemplo n.º 4
0
 protected override void ImportHandHistoriesUsing(IHandHistoryRetriever handHistoryRetriever)
 {
     // Don't call base here since it will end up in a while loop which will never end since our HandHistory retriever mock will never be done.
     RetrieverWithWhichHandHistoriesWereImported = handHistoryRetriever;
 }
Ejemplo n.º 5
0
 public void Invoke_ImportNextBatchOfHandHistoriesUsing(IHandHistoryRetriever handHistoryRetriever)
 {
     ImportNextBatchOfHandHistoriesUsing(handHistoryRetriever);
 }
Ejemplo n.º 6
0
 public void Invoke_PrepareToImportHandHistoriesUsing(IHandHistoryRetriever handHistoryRetriever)
 {
     PrepareToImportHandHistoriesUsing(handHistoryRetriever);
 }