Mercurial > repos > IBDev-IBBoard.WarFoundry.GUI.WinForms
annotate FrmNewArmy.cs @ 62:0e7c257ca8d6 WarFoundry_v0.1beta2_Winforms
Fixes #164: Show unit cost in army tree
* Add points value in army tree for units, category and army (aggregating as it goes up the tree)
* Add code to update tree node text as points values change
* Remove references to now deprecated points-related properties
Also:
* Add rolling log file appender to logging config
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 19 Sep 2009 19:44:45 +0000 |
parents | 11e81ba85684 |
children | c243b043aa62 |
rev | line source |
---|---|
36 | 1 // This file (FrmNewArmy.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard. |
24 | 2 // |
36 | 3 // The file and the library/program it is in are licensed and distributed, without warranty, under the GNU Affero GPL license, either version 3 of the License or (at your option) any later version. Please see COPYING for more information and the full license. |
24 | 4 |
5 using System; | |
6 using System.Drawing; | |
7 using System.ComponentModel; | |
8 using System.Windows.Forms; | |
9 using IBBoard; | |
10 using IBBoard.Lang; | |
11 using IBBoard.Windows.Forms; | |
12 using IBBoard.WarFoundry.API; | |
13 using IBBoard.WarFoundry.API.Objects; | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
14 using IBBoard.Windows.Forms.I18N; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
15 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
16 namespace IBBoard.WarFoundry.GUI.WinForms |
24 | 17 { |
18 /// <summary> | |
19 /// Summary description for FrmNewArmy. | |
20 /// </summary> | |
21 public class FrmNewArmy : IBBForm | |
22 { | |
23 /// <summary> | |
24 /// Required designer variable. | |
25 /// </summary> | |
26 private System.ComponentModel.Container components = null; | |
27 private IBBoard.Windows.Forms.IBBButton bttnCancel; | |
28 private IBBoard.Windows.Forms.IBBLabel lblRaceList; | |
29 private IBBoard.Windows.Forms.IBBButton bttnSelectRace; | |
30 private System.Windows.Forms.ListBox lstRaces; | |
31 private IBBoard.Windows.Forms.IBBLabel lblArmyName; | |
32 private IBBoard.Windows.Forms.IBBLabel lblArmySize; | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
33 private System.Windows.Forms.NumericUpDown armySize; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
34 private Label lblGameSystem; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
35 private ComboBox gameSystems; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
36 private System.Windows.Forms.TextBox txtArmyName; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
37 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
38 private GameSystem system; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
39 private Race race; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
40 private string armyName; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
41 private int maxPoints; |
24 | 42 |
43 public FrmNewArmy(GameSystem system) | |
44 { | |
45 InitializeComponent(); | |
46 | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
47 ControlTranslator.TranslateControl(this); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
48 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
49 foreach (GameSystem gameSystem in WarFoundryLoader.GetDefault().GetGameSystems()) |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
50 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
51 gameSystems.Items.Add(gameSystem); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
52 } |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
53 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
54 if (WarFoundryCore.CurrentGameSystem != null) |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
55 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
56 gameSystems.SelectedItem = FrmMain.CurrentGameSystem; |
24 | 57 } |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
58 } |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
59 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
60 private void SetRaces(GameSystem system) |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
61 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
62 foreach (Race race in WarFoundryLoader.GetDefault().GetRaces(system)) |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
63 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
64 lstRaces.Items.Add(race); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
65 } |
24 | 66 } |
67 | |
68 /// <summary> | |
69 /// Clean up any resources being used. | |
70 /// </summary> | |
71 protected override void Dispose( bool disposing ) | |
72 { | |
73 if( disposing ) | |
74 { | |
75 if(components != null) | |
76 { | |
77 components.Dispose(); | |
78 } | |
79 } | |
80 base.Dispose( disposing ); | |
81 } | |
82 | |
83 #region Windows Form Designer generated code | |
84 /// <summary> | |
85 /// Required method for Designer support - do not modify | |
86 /// the contents of this method with the code editor. | |
87 /// </summary> | |
88 private void InitializeComponent() | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
89 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
90 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewArmy)); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
91 this.lstRaces = new System.Windows.Forms.ListBox(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
92 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
93 this.lblRaceList = new IBBoard.Windows.Forms.IBBLabel(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
94 this.bttnSelectRace = new IBBoard.Windows.Forms.IBBButton(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
95 this.lblArmyName = new IBBoard.Windows.Forms.IBBLabel(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
96 this.txtArmyName = new System.Windows.Forms.TextBox(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
97 this.lblArmySize = new IBBoard.Windows.Forms.IBBLabel(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
98 this.armySize = new System.Windows.Forms.NumericUpDown(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
99 this.lblGameSystem = new System.Windows.Forms.Label(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
100 this.gameSystems = new System.Windows.Forms.ComboBox(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
101 ((System.ComponentModel.ISupportInitialize) (this.armySize)).BeginInit(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
102 this.SuspendLayout(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
103 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
104 // lstRaces |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
105 // |
56
11e81ba85684
Fixes #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
106 this.lstRaces.DisplayMember = "Name"; |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
107 this.lstRaces.Location = new System.Drawing.Point(89, 33); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
108 this.lstRaces.Name = "lstRaces"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
109 this.lstRaces.Size = new System.Drawing.Size(269, 121); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
110 this.lstRaces.TabIndex = 7; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
111 this.lstRaces.SelectedIndexChanged += new System.EventHandler(this.lstRaces_SelectedIndexChanged); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
112 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
113 // bttnCancel |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
114 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
115 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
116 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
117 this.bttnCancel.Location = new System.Drawing.Point(12, 231); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
118 this.bttnCancel.Name = "bttnCancel"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
119 this.bttnCancel.Size = new System.Drawing.Size(80, 24); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
120 this.bttnCancel.TabIndex = 6; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
121 this.bttnCancel.Text = "Cancel"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
122 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
123 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
124 // lblRaceList |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
125 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
126 this.lblRaceList.Location = new System.Drawing.Point(12, 33); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
127 this.lblRaceList.Name = "lblRaceList"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
128 this.lblRaceList.Size = new System.Drawing.Size(71, 80); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
129 this.lblRaceList.TabIndex = 5; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
130 this.lblRaceList.Text = "race list"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
131 this.lblRaceList.TextAlign = System.Drawing.ContentAlignment.TopRight; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
132 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
133 // bttnSelectRace |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
134 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
135 this.bttnSelectRace.Enabled = false; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
136 this.bttnSelectRace.FlatStyle = System.Windows.Forms.FlatStyle.System; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
137 this.bttnSelectRace.Location = new System.Drawing.Point(254, 231); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
138 this.bttnSelectRace.Name = "bttnSelectRace"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
139 this.bttnSelectRace.Size = new System.Drawing.Size(104, 24); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
140 this.bttnSelectRace.TabIndex = 4; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
141 this.bttnSelectRace.Text = "create race"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
142 this.bttnSelectRace.Click += new System.EventHandler(this.bttnSelectRace_Click); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
143 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
144 // lblArmyName |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
145 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
146 this.lblArmyName.Location = new System.Drawing.Point(12, 163); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
147 this.lblArmyName.Name = "lblArmyName"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
148 this.lblArmyName.Size = new System.Drawing.Size(71, 17); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
149 this.lblArmyName.TabIndex = 8; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
150 this.lblArmyName.Text = "army name"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
151 this.lblArmyName.TextAlign = System.Drawing.ContentAlignment.TopRight; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
152 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
153 // txtArmyName |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
154 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
155 this.txtArmyName.Location = new System.Drawing.Point(89, 160); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
156 this.txtArmyName.Name = "txtArmyName"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
157 this.txtArmyName.Size = new System.Drawing.Size(269, 20); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
158 this.txtArmyName.TabIndex = 9; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
159 this.txtArmyName.TextChanged += new System.EventHandler(this.txtArmyName_TextChanged); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
160 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
161 // lblArmySize |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
162 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
163 this.lblArmySize.Location = new System.Drawing.Point(12, 188); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
164 this.lblArmySize.Name = "lblArmySize"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
165 this.lblArmySize.Size = new System.Drawing.Size(71, 18); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
166 this.lblArmySize.TabIndex = 10; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
167 this.lblArmySize.Text = "army size"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
168 this.lblArmySize.TextAlign = System.Drawing.ContentAlignment.TopRight; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
169 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
170 // armySize |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
171 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
172 this.armySize.Increment = new decimal(new int[] { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
173 50, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
174 0, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
175 0, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
176 0}); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
177 this.armySize.Location = new System.Drawing.Point(89, 186); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
178 this.armySize.Maximum = new decimal(new int[] { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
179 1000000, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
180 0, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
181 0, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
182 0}); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
183 this.armySize.Name = "armySize"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
184 this.armySize.Size = new System.Drawing.Size(120, 20); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
185 this.armySize.TabIndex = 11; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
186 this.armySize.ThousandsSeparator = true; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
187 this.armySize.Value = new decimal(new int[] { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
188 2000, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
189 0, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
190 0, |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
191 0}); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
192 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
193 // lblGameSystem |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
194 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
195 this.lblGameSystem.Location = new System.Drawing.Point(12, 9); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
196 this.lblGameSystem.Name = "lblGameSystem"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
197 this.lblGameSystem.Size = new System.Drawing.Size(71, 18); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
198 this.lblGameSystem.TabIndex = 12; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
199 this.lblGameSystem.Text = "game system"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
200 this.lblGameSystem.TextAlign = System.Drawing.ContentAlignment.TopRight; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
201 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
202 // gameSystems |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
203 // |
56
11e81ba85684
Fixes #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
54
diff
changeset
|
204 this.gameSystems.DisplayMember = "Name"; |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
205 this.gameSystems.FormattingEnabled = true; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
206 this.gameSystems.Location = new System.Drawing.Point(89, 6); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
207 this.gameSystems.Name = "gameSystems"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
208 this.gameSystems.Size = new System.Drawing.Size(269, 21); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
209 this.gameSystems.TabIndex = 13; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
210 this.gameSystems.SelectedValueChanged += new System.EventHandler(this.gameSystems_SelectedValueChanged); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
211 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
212 // FrmNewArmy |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
213 // |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
214 this.AcceptButton = this.bttnSelectRace; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
215 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
216 this.CancelButton = this.bttnCancel; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
217 this.ClientSize = new System.Drawing.Size(370, 267); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
218 this.Controls.Add(this.gameSystems); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
219 this.Controls.Add(this.lblGameSystem); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
220 this.Controls.Add(this.armySize); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
221 this.Controls.Add(this.lblArmySize); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
222 this.Controls.Add(this.txtArmyName); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
223 this.Controls.Add(this.lblArmyName); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
224 this.Controls.Add(this.bttnCancel); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
225 this.Controls.Add(this.lblRaceList); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
226 this.Controls.Add(this.bttnSelectRace); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
227 this.Controls.Add(this.lstRaces); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
228 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
229 this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon"))); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
230 this.MaximizeBox = false; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
231 this.MinimizeBox = false; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
232 this.Name = "FrmNewArmy"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
233 this.ShowInTaskbar = false; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
234 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
235 this.Text = "FrmNewArmy"; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
236 ((System.ComponentModel.ISupportInitialize) (this.armySize)).EndInit(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
237 this.ResumeLayout(false); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
238 this.PerformLayout(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
239 |
24 | 240 } |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
241 #endregion |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
242 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
243 public GameSystem SelectedSystem |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
244 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
245 get { return system; } |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
246 } |
24 | 247 |
248 public Race SelectedRace | |
249 { | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
250 get { return race; } |
24 | 251 } |
252 | |
253 public string ArmyName | |
254 { | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
255 get { return armyName; } |
24 | 256 } |
257 | |
258 public int ArmySize | |
259 { | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
260 get { return maxPoints; } |
24 | 261 } |
262 | |
263 private void bttnCancel_Click(object sender, System.EventArgs e) | |
264 { | |
265 DialogResult = DialogResult.Cancel; | |
266 this.Close(); | |
267 } | |
268 | |
269 private void bttnSelectRace_Click(object sender, System.EventArgs e) | |
270 { | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
271 DialogResult = DialogResult.OK; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
272 SetValues(); |
24 | 273 this.Close(); |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
274 } |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
275 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
276 private void SetValues() |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
277 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
278 system = GetSelectedGameSystem(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
279 race = (Race) lstRaces.SelectedItem; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
280 armyName = txtArmyName.Text; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
281 maxPoints = (int) armySize.Value; |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
282 } |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
283 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
284 private GameSystem GetSelectedGameSystem() |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
285 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
286 return (GameSystem) gameSystems.SelectedItem; |
24 | 287 } |
288 | |
289 private void txtArmyName_TextChanged(object sender, System.EventArgs e) | |
290 { | |
291 setSelectRaceEnabledVal(); | |
292 } | |
293 | |
294 private void setSelectRaceEnabledVal() | |
295 { | |
296 bttnSelectRace.Enabled = (lstRaces.SelectedIndex>-1 && txtArmyName.Text.Trim()!="" && armySize.Value > 0); | |
297 } | |
298 | |
299 private void lstRaces_SelectedIndexChanged(object sender, System.EventArgs e) | |
300 { | |
301 setSelectRaceEnabledVal(); | |
54
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
302 } |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
303 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
304 private void gameSystems_SelectedValueChanged(object sender, EventArgs e) |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
305 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
306 GameSystem selected = GetSelectedGameSystem(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
307 lstRaces.Items.Clear(); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
308 |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
309 if (selected != null) |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
310 { |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
311 SetRaces(selected); |
d6ff354a5d84
Re #166: Move game system changing to part of army creation
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
312 } |
24 | 313 } |
314 } | |
315 } |