public void SniperStateChanged(SniperSnapshot newSnapshot) { int row = rowMatching(newSnapshot); snapShots[row] = newSnapshot; setDataRow(row); }
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); }
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); }
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(); }
internal bool IsForSameItemAs(SniperSnapshot sniperSnapshot) { return(ItemId.Equals(sniperSnapshot.ItemId)); }
public void AuctionFailed() { snapShot = snapShot.Failed(); notifyChange(); }
public void AuctionClosed() { snapShot = snapShot.Closed(); notifyChange(); }
public AuctionSniper(Item item, IAuction auction) { this.item = item; this.auction = auction; this.snapShot = SniperSnapshot.Joining(item.Identifier); }
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); }