private void LbCommands_DoubleClick(object sender, EventArgs e) { SportsmanTrening cmd = CommandSelected() as SportsmanTrening; if (cmd != null) { EdTrening.Text = cmd.ToString(); LbTrening.Items.Clear(); foreach (SportsmanCommand item in cmd.List) { LbTrening.Items.Add(item); } LbTrening.SelectedIndex = 0; SomeChanged(); } }
private void BtnAddTrening_Click(object sender, EventArgs e) { int count = LbTrening.Items.Count; SportsmanCommand[] list = new SportsmanCommand[count]; for (int i = 0; i < count; ++i) { list[i] = LbTrening.Items[i] as SportsmanCommand; } SportsmanCommand cmd = new SportsmanTrening(GetTreningName(), list); LbCommands.Items.Add(cmd); LbCommands.SelectedItem = cmd; LbTrening.Items.Clear(); EdTrening.SelectAll(); LbCommands.Focus(); SomeChanged(); }