private void UpdateModifierInfo() { var modifiers = activeItemData.m_Modifiers?.Select ( modifier => new { Key = modifier.m_Type.ToString(), Description = $@"Amount: {modifier.m_Ammount} AmountModifier: {modifier.m_AmountModifier} Timeout: {modifier.m_TimeOut}", Enum = modifier.m_Type, Modifier = modifier } )?.ToList(); ModifierListBox.SelectedIndexChanged -= ModifierListBox_SelectedIndexChanged; ModifierListBox.DataSource = modifiers; ModifierListBox.DisplayMember = "Key"; ModifierListBox.ValueMember = "Description"; ModifierListBox.ClearSelected(); ModifierListBox.SelectedIndexChanged += ModifierListBox_SelectedIndexChanged; }
/// <summary> /// for a given selected record, show its data in the appropriate fields /// </summary> /// <param name="recordName">The name of the record to show</param> private void PopulateFields(string recordName) { int index; if (recordName == string.Empty) { ClearScreen(); DataHasChanged = false; return; } Model.Initialize(recordName); TomeNameInputBox.Text = Model.TomeName; TomeBonusInput.Value = Model.TomeBonus; MinimumLevelInputUpDown.Value = Model.MinLevel; TomeNameLabel.Text = Model.TomeLongName; if (Model.TomeType == "Ability") { TomeTypeAbilityRadioButton.Checked = true; index = AbilityNames.IndexOf(AbilityModel.GetNameFromId(Model.ModifiedID)); ModifierListBox.SetSelected(index, true); } else { TomeTypeSkillRadioButton.Checked = true; index = SkillNames.IndexOf(SkillModel.GetNameFromId(Model.ModifiedID)); ModifierListBox.SetSelected(index, true); } ModVersionLabel.Text = Model.LastUpdatedVersion; ModDateLabel.Text = Model.LastUpdatedDate.ToString(); RecordGUIDLabel.Text = Model.Id.ToString(); //make sure we haven't changed the data (Populating data from the database doesn't count as a change!) DataHasChanged = false; }