private void BtnBuy_Click(object sender, EventArgs e) { ProductCheck(); ICommand buy = new BuyCommand(product); controller.InsertCommand(buy); lbBuy.Text = "You just bought it for " + buy.Execute(); }
static void Main(string[] args) { ICommand command; IMediator mediator = new Mediator(5000, 5000, "Hitler"); IClient firstClient = new Client("Ahmet", 90000); IClient secondClient = new Client("Mehmet", 100000); IClient thirdClient = (IClient)mediator; ICar audi = new Car(secondClient, 10000, "Audi"); secondClient.AddCar(audi, true); ICar bmw = new Car(thirdClient, 5000, "BMW"); thirdClient.AddCar(bmw, true); command = new BuyCommand(audi, firstClient, secondClient, mediator); command.Execute(); command.Unexecute(); System.Console.ReadKey(); }