private void btn_Click(object sender, EventArgs e) { //command pattern cagırma if ((sender as Button).TabIndex == 1) { Klima klima = new Klima(); ICommand2 switchUp2 = new FlipUpCommand2(klima); ICommand2 switchDown = new FlipUpCommand2(klima); Switch2 s2 = new Switch2(); s2.StoreAndExecute(switchUp2); } else if ((sender as Button).TabIndex == 2) { Klima klima = new Klima(); ICommand2 switchDown2 = new FlipDownCommand2(klima); Switch2 s2 = new Switch2(); s2.StoreAndExecute(switchDown2); } }
public FlipDownCommand2(Klima klima) { _klima = klima; }
public FlipUpCommand2(Klima klima) { _klima = klima; }