private void btnAdd_Click(object sender, EventArgs e) { RepopulationPoint repop = new RepopulationPoint(); if( cbClass.SelectedIndex != -1 ) { repop.ClassString = cbClass.Items[cbClass.SelectedIndex] as string; repop.CharacterClass = CharClass.ClassList[cbClass.SelectedIndex]; } if (cbRace.SelectedIndex != -1) { repop.RaceString = cbRace.Items[cbRace.SelectedIndex] as string; repop.Race = Race.RaceList[cbRace.SelectedIndex]; } if (txtIndexNumber.Text != String.Empty) { int indexNumber = 0; if (Int32.TryParse(txtIndexNumber.Text, out indexNumber)) { repop.RoomIndexNumber = indexNumber; } } lstRepops.Items.Add(repop); lstRepops.SelectedIndex = lstRepops.Items.Count - 1; }
private void UpdateWindowContents(RepopulationPoint repop) { txtIndexNumber.Text = repop.RoomIndexNumber.ToString(); cbRace.SelectedIndex = repop.RaceNumber; cbClass.SelectedIndex = repop.ClassNumber; }