private void btnAddToList_Click(object sender, EventArgs e) { DialogNewPerson dialogNewPerson = new DialogNewPerson(); if (dialogNewPerson.ShowDialog() != DialogResult.OK) { return; } Engine.PlayerList.AddPlayer(dialogNewPerson.NewPlayer); this.ddlPeople.Items.Insert(0, (object)dialogNewPerson.NewPlayer); this.ddlPeople.SelectedIndex = 0; }
private void btnFindByCossyID_Click(object sender, EventArgs e) { DialogNewPerson dialogNewPerson = new DialogNewPerson(); dialogNewPerson.ReadOnly = true; dialogNewPerson.Title = "Enter ID"; if (dialogNewPerson.ShowDialog() != DialogResult.OK) { return; } this.ddlPlayers.SelectedIndex = -1; for (int index = 0; index < this.ddlPlayers.Items.Count; ++index) { if (((IPlayer)this.ddlPlayers.Items[index]).ID == dialogNewPerson.NewPlayer.ID) { this.ddlPlayers.SelectedIndex = index; break; } } }