Exemplo n.º 1
0
        private void updateNextAuctions()
        {
            List <AuctionRunner> nextAuctions = AuctionRunners.Where(runner => runner.auction.IsActive == false && runner.auction.IsOver == false &&
                                                                     runner.auction.StartDate < DateTime.Now && !_dueToBeginAuctions.Contains(runner)).ToList();

            foreach (var runner in nextAuctions)
            {
                _dueToBeginAuctions.Add(runner);
            }
        }
Exemplo n.º 2
0
        public void RunAuctions()
        {
            updateNextAuctions();
            List <AuctionRunner> nextAuctions = new List <AuctionRunner>(_dueToBeginAuctions);

            Parallel.ForEach(nextAuctions ?? new List <AuctionRunner>(), runner =>
            {
                _dueToBeginAuctions.Remove(runner);
                runner.RunAuction();
            });

            if (AuctionRunners?.Where(runner => runner.auction.IsOver == true).ToList().Count == AuctionRunners.Count)
            {
                string msg = "All auctions are over. See you next Time!";
                _notifier.NotifyChange(msg);
                _runAuctionsTimer.Stop();
            }
        }