Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
comparison FrmUnit.cs @ 85:0bb9f40d44eb
Re #88: Complete initial WinForms UI
* Add basic initial "about" box
* Translations (below)
Re #179: Make sure that translations are used throughout UI
* Make all controls translatable
* Supply translations for all controls
Re #204: Use new limits in WinForms UI
* Warn the user and cap the number if we try to go out of range for equipment
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 31 Oct 2009 20:54:42 +0000 |
parents | 1e85a0687e4d |
children | e4a8653b9536 |
comparison
equal
deleted
inserted
replaced
84:1e85a0687e4d | 85:0bb9f40d44eb |
---|---|
9 using System.ComponentModel; | 9 using System.ComponentModel; |
10 using System.Windows.Forms; | 10 using System.Windows.Forms; |
11 using IBBoard.Commands; | 11 using IBBoard.Commands; |
12 using IBBoard.Lang; | 12 using IBBoard.Lang; |
13 using IBBoard.Windows.Forms; | 13 using IBBoard.Windows.Forms; |
14 using IBBoard.Windows.Forms.I18N; | |
14 using IBBoard.WarFoundry.API; | 15 using IBBoard.WarFoundry.API; |
15 using IBBoard.WarFoundry.API.Commands; | 16 using IBBoard.WarFoundry.API.Commands; |
16 using IBBoard.WarFoundry.API.Objects; | 17 using IBBoard.WarFoundry.API.Objects; |
17 using IBBoard.WarFoundry.GUI.WinForms.UI; | 18 using IBBoard.WarFoundry.GUI.WinForms.UI; |
18 using IBBoard.WarFoundry.GUI.WinForms.Util; | 19 using IBBoard.WarFoundry.GUI.WinForms.Util; |
28 private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>(); | 29 private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>(); |
29 private CommandStack commandStack; | 30 private CommandStack commandStack; |
30 private System.Windows.Forms.DataGrid statsGrid; | 31 private System.Windows.Forms.DataGrid statsGrid; |
31 private System.Windows.Forms.TextBox tbUnitName; | 32 private System.Windows.Forms.TextBox tbUnitName; |
32 private System.Windows.Forms.NumericUpDown unitSize; | 33 private System.Windows.Forms.NumericUpDown unitSize; |
33 private System.Windows.Forms.Label lblUnitSize; | 34 private IBBLabel lblUnitSize; |
34 private System.Windows.Forms.Button bttnAddWeapon; | 35 private IBBButton bttnAddWeapon; |
35 private System.Windows.Forms.Button bttnRemoveWeapon; | 36 private IBBButton bttnRemoveWeapon; |
36 private System.Windows.Forms.Label lblEquip; | 37 private IBBLabel lblEquip; |
37 private System.Windows.Forms.ListBox equipmentList; | 38 private System.Windows.Forms.ListBox equipmentList; |
38 private System.Windows.Forms.Button bttnReplaceWeapon; | 39 private IBBButton bttnReplaceWeapon; |
39 private System.Windows.Forms.Button bttnEditWeapon; | 40 private IBBButton bttnEditWeapon; |
40 private Label lblPoints; | 41 private Label lblPoints; |
41 /// <summary> | 42 /// <summary> |
42 /// Required designer variable. | 43 /// Required designer variable. |
43 /// </summary> | 44 /// </summary> |
44 private System.ComponentModel.Container components = null; | 45 private System.ComponentModel.Container components = null; |
49 commandStack = cmdStack; | 50 commandStack = cmdStack; |
50 // | 51 // |
51 // Required for Windows Form Designer support | 52 // Required for Windows Form Designer support |
52 // | 53 // |
53 InitializeComponent(); | 54 InitializeComponent(); |
54 | 55 ControlTranslator.TranslateControl(this); |
55 tbUnitName.Text = unit.Name; | 56 Text = Translation.GetTranslation("FrmUnit", "{0}", unit.Name); |
56 Text = unit.Name; | |
57 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); | 57 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged); |
58 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); | 58 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged); |
59 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); | 59 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged); |
60 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); | 60 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged); |
61 | 61 |
179 private void InitializeComponent() | 179 private void InitializeComponent() |
180 { | 180 { |
181 this.statsGrid = new System.Windows.Forms.DataGrid(); | 181 this.statsGrid = new System.Windows.Forms.DataGrid(); |
182 this.tbUnitName = new System.Windows.Forms.TextBox(); | 182 this.tbUnitName = new System.Windows.Forms.TextBox(); |
183 this.unitSize = new System.Windows.Forms.NumericUpDown(); | 183 this.unitSize = new System.Windows.Forms.NumericUpDown(); |
184 this.lblUnitSize = new System.Windows.Forms.Label(); | 184 this.lblUnitSize = new IBBLabel(); |
185 this.lblEquip = new System.Windows.Forms.Label(); | 185 this.lblEquip = new IBBLabel(); |
186 this.bttnAddWeapon = new System.Windows.Forms.Button(); | 186 this.bttnAddWeapon = new IBBButton(); |
187 this.bttnRemoveWeapon = new System.Windows.Forms.Button(); | 187 this.bttnRemoveWeapon = new IBBButton(); |
188 this.equipmentList = new System.Windows.Forms.ListBox(); | 188 this.equipmentList = new System.Windows.Forms.ListBox(); |
189 this.bttnReplaceWeapon = new System.Windows.Forms.Button(); | 189 this.bttnReplaceWeapon = new IBBButton(); |
190 this.bttnEditWeapon = new System.Windows.Forms.Button(); | 190 this.bttnEditWeapon = new IBBButton(); |
191 this.lblPoints = new System.Windows.Forms.Label(); | 191 this.lblPoints = new System.Windows.Forms.Label(); |
192 ((System.ComponentModel.ISupportInitialize) (this.statsGrid)).BeginInit(); | 192 ((System.ComponentModel.ISupportInitialize) (this.statsGrid)).BeginInit(); |
193 ((System.ComponentModel.ISupportInitialize) (this.unitSize)).BeginInit(); | 193 ((System.ComponentModel.ISupportInitialize) (this.unitSize)).BeginInit(); |
194 this.SuspendLayout(); | 194 this.SuspendLayout(); |
195 // | 195 // |