comparison FrmUnit.cs @ 143:28105d9c2b25

Re #265: Add language preference UI * Make unit form and army tree translate on translation language change Army tree title translation still seems patchy
author IBBoard <dev@ibboard.co.uk>
date Wed, 14 Apr 2010 19:59:35 +0000
parents 18d607b0249b
children 51463bc1fb21
comparison
equal deleted inserted replaced
142:e0af96397e26 143:28105d9c2b25
54 commandStack = cmdStack; 54 commandStack = cmdStack;
55 // 55 //
56 // Required for Windows Form Designer support 56 // Required for Windows Form Designer support
57 // 57 //
58 InitializeComponent(); 58 InitializeComponent();
59 ControlTranslator.TranslateControl(this); 59 TranslateForm();
60 tbUnitName.Text = unit.Name; 60 Translation.TranslationChanged += new MethodInvoker(TranslateForm);
61 Text = Translation.GetTranslation("FrmUnit", "{0}", unit.Name);
62 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); 61 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged);
63 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); 62 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged);
64 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); 63 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged);
65 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); 64 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged);
66 65
73 abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities()); 72 abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities());
74 abilitiesList.DisplayMember = "Name"; 73 abilitiesList.DisplayMember = "Name";
75 SetPointsValueText(); 74 SetPointsValueText();
76 SetStats(); 75 SetStats();
77 SetWeapons(); 76 SetWeapons();
77 }
78
79 private void TranslateForm()
80 {
81 ControlTranslator.TranslateControl(this);
82 tbUnitName.Text = unit.Name;
83 Text = Translation.GetTranslation("FrmUnit", "{0}", unit.Name);
78 } 84 }
79 85
80 void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue) 86 void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue)
81 { 87 {
82 SetPointsValueText(); 88 SetPointsValueText();