コード例 #1
0
        public void SniperStateChanged(SniperSnapshot newSnapshot)
        {
            int row = rowMatching(newSnapshot);

            snapShots[row] = newSnapshot;

            setDataRow(row);
        }
コード例 #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);
        }
コード例 #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);
        }
コード例 #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();
        }
コード例 #5
0
 internal bool IsForSameItemAs(SniperSnapshot sniperSnapshot)
 {
     return(ItemId.Equals(sniperSnapshot.ItemId));
 }
コード例 #6
0
 public void AuctionFailed()
 {
     snapShot = snapShot.Failed();
     notifyChange();
 }
コード例 #7
0
 public void AuctionClosed()
 {
     snapShot = snapShot.Closed();
     notifyChange();
 }
コード例 #8
0
 public AuctionSniper(Item item, IAuction auction)
 {
     this.item     = item;
     this.auction  = auction;
     this.snapShot = SniperSnapshot.Joining(item.Identifier);
 }
コード例 #9
0
 public void AddSniperSnapShot(SniperSnapshot sniperSnapshot)
 {
     snapShots.Add(sniperSnapshot);
     SniperStateChanged(sniperSnapshot);
 }
コード例 #10
0
 public void SniperStateChanged(SniperSnapshot newSnapShot)
 {
     snipers.SniperStateChanged(newSnapShot);
 }
コード例 #11
0
 public void SniperBidding(SniperSnapshot newSnapShot)
 {
     SniperStateChanged(newSnapShot);
 }