public void CommandPatternDemo() { Broker broker = new Broker(); Stock stock = new Stock(); BuyStock buyStock = new BuyStock(stock); SellStock sellStock = new SellStock(stock); broker.TakeOrder(buyStock); broker.TakeOrder(sellStock); broker.ReplaceOrders(); }
private void btCommandPattern_Click(object sender, EventArgs e) { Stock abcStock = new Stock(); BuyStock buyStockOrder = new BuyStock(abcStock); SellStock sellStockOrder = new SellStock(abcStock); Broker broker = new Broker(); broker.takeOrder(buyStockOrder); broker.takeOrder(sellStockOrder); tbOutWindow.Text = broker.placeOrders(); }