Esempio n. 1
0
        public void SniperStateChanged(SniperSnapshot newSnapshot)
        {
            int row = rowMatching(newSnapshot);

            snapShots[row] = newSnapshot;

            setDataRow(row);
        }
Esempio n. 2
0
        public override bool Equals(object obj)
        {
            SniperSnapshot snapShot = obj as SniperSnapshot;

            if (snapShot == null)
            {
                return(false);
            }

            return(this.ItemId.Equals(snapShot.ItemId) && this.LastBid == snapShot.LastBid && this.LastPrice == snapShot.LastPrice && this.State == snapShot.State);
        }
Esempio n. 3
0
        private int rowMatching(SniperSnapshot snapShot)
        {
            for (int i = 0; i < snapShots.Count; i++)
            {
                if (snapShot.IsForSameItemAs(snapShots[i]))
                {
                    return(i);
                }
            }

            throw new InvalidOperationException("Can not find match for " + snapShot);
        }
Esempio n. 4
0
        public void CurrentPrice(int price, int increment, PriceSource priceSource)
        {
            switch (priceSource)
            {
            case PriceSource.FromSniper:
                snapShot = snapShot.Winning(price);
                break;

            case PriceSource.FromOtherBidder:
                int bid = price + increment;
                if (item.AllowsBid(bid))
                {
                    auction.Bid(bid);
                    snapShot = snapShot.Bidding(price, bid);
                }
                else
                {
                    snapShot = snapShot.Losing(price);
                }
                break;
            }

            notifyChange();
        }
Esempio n. 5
0
 internal bool IsForSameItemAs(SniperSnapshot sniperSnapshot)
 {
     return(ItemId.Equals(sniperSnapshot.ItemId));
 }
Esempio n. 6
0
 public void AuctionFailed()
 {
     snapShot = snapShot.Failed();
     notifyChange();
 }
Esempio n. 7
0
 public void AuctionClosed()
 {
     snapShot = snapShot.Closed();
     notifyChange();
 }
Esempio n. 8
0
 public AuctionSniper(Item item, IAuction auction)
 {
     this.item     = item;
     this.auction  = auction;
     this.snapShot = SniperSnapshot.Joining(item.Identifier);
 }
Esempio n. 9
0
 public void AddSniperSnapShot(SniperSnapshot sniperSnapshot)
 {
     snapShots.Add(sniperSnapshot);
     SniperStateChanged(sniperSnapshot);
 }
 public void SniperStateChanged(SniperSnapshot newSnapShot)
 {
     snipers.SniperStateChanged(newSnapShot);
 }
 public void SniperBidding(SniperSnapshot newSnapShot)
 {
     SniperStateChanged(newSnapShot);
 }