Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
changeset 109:f4d3e64bdb18
Fixes #221: Changing unit size doesn't update text of equipment items
* Simple fix - on unit size change, re-set all equipment item values in the table
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Thu, 17 Dec 2009 20:54:55 +0000 |
parents | 6871c9788ce1 |
children | 39b93ca5fb9c |
files | FrmUnit.cs |
diffstat | 1 files changed, 20 insertions(+), 10 deletions(-) [+] |
line wrap: on
line diff
--- a/FrmUnit.cs Sun Dec 13 20:15:26 2009 +0000 +++ b/FrmUnit.cs Thu Dec 17 20:54:55 2009 +0000 @@ -460,6 +460,11 @@ if (obj is Unit && obj.Equals(unit)) { unitSize.Value = newValue; + + foreach (UnitEquipmentChoice choice in equipmentChoices.Values) + { + SetEquipmentListValue(choice); + } } } @@ -490,17 +495,22 @@ } else { - int idx = equipmentList.Items.IndexOf(equipChoice); + SetEquipmentListValue(equipChoice); + } + } + } - if (idx > -1) - { - equipmentList.Items[idx] = equipChoice; - } - else - { - equipmentList.Items.Add(equipChoice); - } - } + private void SetEquipmentListValue(UnitEquipmentChoice equipChoice) + { + int idx = equipmentList.Items.IndexOf(equipChoice); + + if (idx > -1) + { + equipmentList.Items[idx] = equipChoice; + } + else + { + equipmentList.Items.Add(equipChoice); } }