コード例 #1
0
        public void InvokeProcessMessage(MessageListenerEventArgs mle)
        {
            if (MessageHasPairedValues(mle))
            {
                var auctionEvent = AuctionEvent.From(mle.Message.Body);

                switch (auctionEvent.Type)
                {
                case "CLOSE":
                    _auctionEventListener.AuctionClosed();
                    break;

                case "PRICE":
                    _auctionEventListener.CurrentPrice(auctionEvent.CurrentPrice, auctionEvent.Increment, auctionEvent.IsFrom(_sniperId));
                    break;

                default:
                    string messageDetail =
                        $"Message type: {auctionEvent.Type} not handled, from message {mle.Message.Body}";
                    throw new Exception(messageDetail);
                }
            }
            else
            {
                if (mle.Message.Body.Contains(SharedConstants.STATUS_JOINING))
                {
                    _auctionEventListener.JoiningAuction();
                }
            }
        }
コード例 #2
0
 // creation method
 public static AuctionEvent From(string messageBody)
 {
     var auctionEvent = new AuctionEvent();
     foreach (string field in GenerateFieldPairs(messageBody))
     {
         auctionEvent.AddField(field);
     }
     return auctionEvent;
 }
コード例 #3
0
        // creation method
        public static AuctionEvent From(string messageBody)
        {
            var auctionEvent = new AuctionEvent();

            foreach (string field in GenerateFieldPairs(messageBody))
            {
                auctionEvent.AddField(field);
            }
            return(auctionEvent);
        }