Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
annotate FrmNewArmy.cs @ 9:ffb49ec86df7
Closes #42 - Update translations file to use Schema (WinForms)
* Update WinForms GUI translations to use namespace for schema instead of DTD
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Tue, 19 May 2009 11:10:07 +0000 |
parents | 8935971e307c |
children | 7c366fe55635 |
rev | line source |
---|---|
3
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
1 // This file (FrmNewArmy.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard. |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
2 // |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license. |
8935971e307c
Fixes #1 - Correctly license code
IBBoard <dev@ibboard.co.uk>
parents:
1
diff
changeset
|
4 |
0 | 5 using System; |
6 using System.Drawing; | |
7 using System.Collections; | |
8 using System.ComponentModel; | |
9 using System.Windows.Forms; | |
10 using IBBoard; | |
11 using IBBoard.Lang; | |
12 using IBBoard.Windows.Forms; | |
13 using IBBoard.WarFoundry.API; | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
14 using IBBoard.WarFoundry.API.Objects; |
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
15 using IBBoard.Windows.Forms.I18N; |
0 | 16 |
17 namespace IBBoard.WarFoundry | |
18 { | |
19 /// <summary> | |
20 /// Summary description for FrmNewArmy. | |
21 /// </summary> | |
22 public class FrmNewArmy : IBBForm | |
23 { | |
24 /// <summary> | |
25 /// Required designer variable. | |
26 /// </summary> | |
27 private System.ComponentModel.Container components = null; | |
28 private IBBoard.Windows.Forms.IBBButton bttnCancel; | |
29 private IBBoard.Windows.Forms.IBBLabel lblRaceList; | |
30 private IBBoard.Windows.Forms.IBBButton bttnSelectRace; | |
31 private System.Windows.Forms.ListBox lstRaces; | |
32 private Race[] races; | |
33 private IBBoard.Windows.Forms.IBBLabel lblArmyName; | |
34 private IBBoard.Windows.Forms.IBBLabel lblArmySize; | |
35 private System.Windows.Forms.NumericUpDown armySize; | |
36 private System.Windows.Forms.TextBox txtArmyName; | |
37 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
38 public FrmNewArmy(GameSystem system) |
0 | 39 { |
40 InitializeComponent(); | |
41 | |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
42 ControlTranslator.TranslateControl(this); |
0 | 43 |
1
42cf06b8f897
Re #8 - Get a working Windows WarFoundry
IBBoard <dev@ibboard.co.uk>
parents:
0
diff
changeset
|
44 races = WarFoundryLoader.GetDefault().GetRaces(system); |
0 | 45 |
46 for (int i = 0; i<races.Length; i++) | |
47 { | |
48 lstRaces.Items.Add(races[i].Name); | |
49 } | |
50 } | |
51 | |
52 /// <summary> | |
53 /// Clean up any resources being used. | |
54 /// </summary> | |
55 protected override void Dispose( bool disposing ) | |
56 { | |
57 if( disposing ) | |
58 { | |
59 if(components != null) | |
60 { | |
61 components.Dispose(); | |
62 } | |
63 } | |
64 base.Dispose( disposing ); | |
65 } | |
66 | |
67 #region Windows Form Designer generated code | |
68 /// <summary> | |
69 /// Required method for Designer support - do not modify | |
70 /// the contents of this method with the code editor. | |
71 /// </summary> | |
72 private void InitializeComponent() | |
73 { | |
74 System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(FrmNewArmy)); | |
75 this.lstRaces = new System.Windows.Forms.ListBox(); | |
76 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); | |
77 this.lblRaceList = new IBBoard.Windows.Forms.IBBLabel(); | |
78 this.bttnSelectRace = new IBBoard.Windows.Forms.IBBButton(); | |
79 this.lblArmyName = new IBBoard.Windows.Forms.IBBLabel(); | |
80 this.txtArmyName = new System.Windows.Forms.TextBox(); | |
81 this.lblArmySize = new IBBoard.Windows.Forms.IBBLabel(); | |
82 this.armySize = new System.Windows.Forms.NumericUpDown(); | |
83 ((System.ComponentModel.ISupportInitialize)(this.armySize)).BeginInit(); | |
84 this.SuspendLayout(); | |
85 // | |
86 // lstRaces | |
87 // | |
88 this.lstRaces.Location = new System.Drawing.Point(88, 8); | |
89 this.lstRaces.Name = "lstRaces"; | |
90 this.lstRaces.Size = new System.Drawing.Size(272, 121); | |
91 this.lstRaces.TabIndex = 7; | |
92 this.lstRaces.SelectedIndexChanged += new System.EventHandler(this.lstRaces_SelectedIndexChanged); | |
93 // | |
94 // bttnCancel | |
95 // | |
96 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; | |
97 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
98 this.bttnCancel.Location = new System.Drawing.Point(8, 200); | |
99 this.bttnCancel.Name = "bttnCancel"; | |
100 this.bttnCancel.Size = new System.Drawing.Size(80, 24); | |
101 this.bttnCancel.TabIndex = 6; | |
102 this.bttnCancel.Text = "Cancel"; | |
103 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); | |
104 // | |
105 // lblRaceList | |
106 // | |
107 this.lblRaceList.Location = new System.Drawing.Point(0, 8); | |
108 this.lblRaceList.Name = "lblRaceList"; | |
109 this.lblRaceList.Size = new System.Drawing.Size(88, 80); | |
110 this.lblRaceList.TabIndex = 5; | |
111 this.lblRaceList.Text = "race list"; | |
112 this.lblRaceList.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
113 // | |
114 // bttnSelectRace | |
115 // | |
116 this.bttnSelectRace.Enabled = false; | |
117 this.bttnSelectRace.FlatStyle = System.Windows.Forms.FlatStyle.System; | |
118 this.bttnSelectRace.Location = new System.Drawing.Point(256, 200); | |
119 this.bttnSelectRace.Name = "bttnSelectRace"; | |
120 this.bttnSelectRace.Size = new System.Drawing.Size(104, 24); | |
121 this.bttnSelectRace.TabIndex = 4; | |
122 this.bttnSelectRace.Text = "create race"; | |
123 this.bttnSelectRace.Click += new System.EventHandler(this.bttnSelectRace_Click); | |
124 // | |
125 // lblArmyName | |
126 // | |
127 this.lblArmyName.Location = new System.Drawing.Point(0, 136); | |
128 this.lblArmyName.Name = "lblArmyName"; | |
129 this.lblArmyName.Size = new System.Drawing.Size(88, 32); | |
130 this.lblArmyName.TabIndex = 8; | |
131 this.lblArmyName.Text = "army name"; | |
132 this.lblArmyName.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
133 // | |
134 // txtArmyName | |
135 // | |
136 this.txtArmyName.Location = new System.Drawing.Point(88, 136); | |
137 this.txtArmyName.Name = "txtArmyName"; | |
138 this.txtArmyName.Size = new System.Drawing.Size(272, 20); | |
139 this.txtArmyName.TabIndex = 9; | |
140 this.txtArmyName.Text = ""; | |
141 this.txtArmyName.TextChanged += new System.EventHandler(this.txtArmyName_TextChanged); | |
142 // | |
143 // lblArmySize | |
144 // | |
145 this.lblArmySize.Location = new System.Drawing.Point(0, 168); | |
146 this.lblArmySize.Name = "lblArmySize"; | |
147 this.lblArmySize.Size = new System.Drawing.Size(88, 32); | |
148 this.lblArmySize.TabIndex = 10; | |
149 this.lblArmySize.Text = "army size"; | |
150 this.lblArmySize.TextAlign = System.Drawing.ContentAlignment.TopRight; | |
151 // | |
152 // armySize | |
153 // | |
154 this.armySize.Increment = new System.Decimal(new int[] { | |
155 50, | |
156 0, | |
157 0, | |
158 0}); | |
159 this.armySize.Location = new System.Drawing.Point(88, 168); | |
160 this.armySize.Maximum = new System.Decimal(new int[] { | |
161 1000000, | |
162 0, | |
163 0, | |
164 0}); | |
165 this.armySize.Name = "armySize"; | |
166 this.armySize.TabIndex = 11; | |
167 this.armySize.ThousandsSeparator = true; | |
168 this.armySize.Value = new System.Decimal(new int[] { | |
169 2000, | |
170 0, | |
171 0, | |
172 0}); | |
173 // | |
174 // FrmNewArmy | |
175 // | |
176 this.AcceptButton = this.bttnSelectRace; | |
177 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); | |
178 this.CancelButton = this.bttnCancel; | |
179 this.ClientSize = new System.Drawing.Size(370, 228); | |
180 this.Controls.Add(this.armySize); | |
181 this.Controls.Add(this.lblArmySize); | |
182 this.Controls.Add(this.txtArmyName); | |
183 this.Controls.Add(this.lblArmyName); | |
184 this.Controls.Add(this.bttnCancel); | |
185 this.Controls.Add(this.lblRaceList); | |
186 this.Controls.Add(this.bttnSelectRace); | |
187 this.Controls.Add(this.lstRaces); | |
188 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; | |
189 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); | |
190 this.MaximizeBox = false; | |
191 this.MinimizeBox = false; | |
192 this.Name = "FrmNewArmy"; | |
193 this.ShowInTaskbar = false; | |
194 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; | |
195 this.Text = "FrmNewArmy"; | |
196 ((System.ComponentModel.ISupportInitialize)(this.armySize)).EndInit(); | |
197 this.ResumeLayout(false); | |
198 | |
199 } | |
200 #endregion | |
201 | |
202 public Race SelectedRace | |
203 { | |
204 get { return races[lstRaces.SelectedIndex]; } | |
205 } | |
206 | |
207 public string ArmyName | |
208 { | |
209 get { return txtArmyName.Text; } | |
210 } | |
211 | |
212 public int ArmySize | |
213 { | |
214 get { return (int)armySize.Value; } | |
215 } | |
216 | |
217 private void bttnCancel_Click(object sender, System.EventArgs e) | |
218 { | |
219 DialogResult = DialogResult.Cancel; | |
220 this.Close(); | |
221 } | |
222 | |
223 private void bttnSelectRace_Click(object sender, System.EventArgs e) | |
224 { | |
225 DialogResult = DialogResult.OK; | |
226 this.Close(); | |
227 } | |
228 | |
229 private void txtArmyName_TextChanged(object sender, System.EventArgs e) | |
230 { | |
231 setSelectRaceEnabledVal(); | |
232 } | |
233 | |
234 private void setSelectRaceEnabledVal() | |
235 { | |
236 bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0); | |
237 } | |
238 | |
239 private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) | |
240 { | |
241 setSelectRaceEnabledVal(); | |
242 } | |
243 } | |
244 } |