public Sportsmen(string name, StrategyRun srun, StrategyJump sjump, StrategySwim sswim) { this.name = name; this.srun = srun; this.sjump = sjump; this.sswim = sswim; }
private void btnExecute_Click(object sender, EventArgs e) { string sportsmenName = txtSportsmenName.Text.Trim(); StrategyRun run = StrategyRunFactory.make(cbRun.SelectedItem.ToString()); StrategyJump jump = StrategyJumpFactory.make(cbJump.SelectedItem.ToString()); StrategySwim swim = StrategySwimFactory.make(cbSwim.SelectedItem.ToString()); Sportsmen sportsmen = new Sportsmen(sportsmenName, run, jump, swim); SportsmenCommand cmd = (SportsmenCommand)lbCommands.SelectedItem; txtLog.AppendText(sportsmen.execute(cmd) + Environment.NewLine); }