Exemplo n.º 1
0
        public void UpdateTrade(TradeResponse trade)
        {
            Invoke(new MethodInvoker(
                       delegate
                       {
                           tradeRequestTickerSymbol.Text = string.Empty;

                           if (trade.Error)
                           {
                               var msg = string.Format("Error processing {0} shares of {1}:\n{2}", trade.Quantity, trade.Ticker, trade.ErrorMessage);
                               MessageBox.Show(msg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                           }
                           else
                           {
                               var purchasedOrSold = trade.BuyRequest ? "Purchased" : "Sold";

                               var msg = string.Format("Confirmed. {0} {1} shares of {2}\nfor a total cost of {3} ", purchasedOrSold, trade.Quantity, trade.Ticker, trade.Price);
                               MessageBox.Show(msg, "Trade Completed", MessageBoxButtons.OK, MessageBoxIcon.Information);
                           }
                       }));
        }
 public void Handle(TradeResponse tradeResponse)
 {
     log.Info(string.Format("Received trade resonse.  Ticker = {0}, Price = {1}", tradeResponse.Ticker, tradeResponse.Price));
     // forward to controller to update view
     _stockController.UpdateTrade(tradeResponse);
 }
 public void UpdateTrade(TradeResponse tradeResponse)
 {
     if (stockForm != null)
     {
         stockForm.UpdateTrade(tradeResponse);
     }
 }