Mercurial > repos > IBBoard.WarFoundry.GUI.WinForms
annotate FrmNewUnit.cs @ 184:d97de6f980b4
Re #88: WinForms UI
* Keep last 25 log files to stop log folder bloat
author | IBBoard <dev@ibboard.co.uk> |
---|---|
date | Sat, 30 Oct 2010 10:13:59 +0000 |
parents | 1bcd7ea857c4 |
children | 137ec6d45280 |
rev | line source |
---|---|
36 | 1 // This file (FrmNewUnit.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; | |
14 using IBBoard.Windows.Forms.I18N; | |
15 | |
16 namespace IBBoard.WarFoundry | |
17 { | |
18 /// <summary> | |
19 /// Summary description for FrmNewUnit. | |
20 /// </summary> | |
21 public class FrmNewUnit : IBBForm | |
22 { | |
23 private System.ComponentModel.IContainer components; | |
24 private IBBoard.Windows.Forms.IBBButton bttnCancel; | |
25 private IBBoard.Windows.Forms.IBBLabel lblUnitList; | |
26 private IBBoard.Windows.Forms.IBBButton bttnSelectUnit; | |
27 private System.Windows.Forms.ListBox lstUnits; | |
28 private UnitType[] units; | |
29 private Army army; | |
30 private System.Windows.Forms.ImageList imageList; | |
31 private System.Windows.Forms.Label lblNewUnitWarning; | |
32 private System.Windows.Forms.Label lblWarningIcon; | |
33 private bool[] allowed; | |
34 | |
35 public FrmNewUnit(Race race, Category cat, Army army) | |
36 { | |
37 InitializeComponent(); | |
38 | |
39 ControlTranslator.TranslateControl(this, cat.Name); | |
40 units = race.GetUnitTypes(cat); | |
41 allowed = new bool[units.Length]; | |
42 this.army = army; | |
43 | |
44 for (int i = 0; i<units.Length; i++) | |
45 { | |
46 allowed[i] = army.CanAddUnitType(units[i]).Count == 0; | |
47 lstUnits.Items.Add(units[i].Name); | |
48 } | |
49 } | |
50 | |
51 /// <summary> | |
52 /// Clean up any resources being used. | |
53 /// </summary> | |
54 protected override void Dispose( bool disposing ) | |
55 { | |
56 if( disposing ) | |
57 { | |
58 if(components != null) | |
59 { | |
60 components.Dispose(); | |
61 } | |
62 } | |
63 base.Dispose( disposing ); | |
64 } | |
65 | |
66 #region Windows Form Designer generated code | |
67 /// <summary> | |
68 /// Required method for Designer support - do not modify | |
69 /// the contents of this method with the code editor. | |
70 /// </summary> | |
71 private void InitializeComponent() | |
147
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
72 { |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
73 this.components = new System.ComponentModel.Container(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
74 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewUnit)); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
75 this.lstUnits = new System.Windows.Forms.ListBox(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
76 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
77 this.lblUnitList = new IBBoard.Windows.Forms.IBBLabel(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
78 this.bttnSelectUnit = new IBBoard.Windows.Forms.IBBButton(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
79 this.lblNewUnitWarning = new System.Windows.Forms.Label(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
80 this.imageList = new System.Windows.Forms.ImageList(this.components); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
81 this.lblWarningIcon = new System.Windows.Forms.Label(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
82 this.SuspendLayout(); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
83 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
84 // lstUnits |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
85 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
86 this.lstUnits.Location = new System.Drawing.Point(88, 8); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
87 this.lstUnits.Name = "lstUnits"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
88 this.lstUnits.Size = new System.Drawing.Size(272, 121); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
89 this.lstUnits.TabIndex = 7; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
90 this.lstUnits.SelectedIndexChanged += new System.EventHandler(this.lstUnits_SelectedIndexChanged); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
91 this.lstUnits.DoubleClick += new System.EventHandler(this.lstUnits_DoubleClick); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
92 this.lstUnits.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstUnits_MouseDown); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
93 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
94 // bttnCancel |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
95 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
96 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
97 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
98 this.bttnCancel.Location = new System.Drawing.Point(8, 168); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
99 this.bttnCancel.Name = "bttnCancel"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
100 this.bttnCancel.Size = new System.Drawing.Size(80, 24); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
101 this.bttnCancel.TabIndex = 6; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
102 this.bttnCancel.Text = "Cancel"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
103 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
104 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
105 // lblUnitList |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
106 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
107 this.lblUnitList.Location = new System.Drawing.Point(0, 8); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
108 this.lblUnitList.Name = "lblUnitList"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
109 this.lblUnitList.Size = new System.Drawing.Size(88, 80); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
110 this.lblUnitList.TabIndex = 5; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
111 this.lblUnitList.Text = "unit list"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
112 this.lblUnitList.TextAlign = System.Drawing.ContentAlignment.TopRight; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
113 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
114 // bttnSelectUnit |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
115 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
116 this.bttnSelectUnit.Enabled = false; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
117 this.bttnSelectUnit.FlatStyle = System.Windows.Forms.FlatStyle.System; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
118 this.bttnSelectUnit.Location = new System.Drawing.Point(256, 168); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
119 this.bttnSelectUnit.Name = "bttnSelectUnit"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
120 this.bttnSelectUnit.Size = new System.Drawing.Size(104, 24); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
121 this.bttnSelectUnit.TabIndex = 4; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
122 this.bttnSelectUnit.Text = "create unit"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
123 this.bttnSelectUnit.Click += new System.EventHandler(this.bttnSelectUnit_Click); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
124 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
125 // lblNewUnitWarning |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
126 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
127 this.lblNewUnitWarning.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
128 this.lblNewUnitWarning.ImageList = this.imageList; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
129 this.lblNewUnitWarning.Location = new System.Drawing.Point(48, 136); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
130 this.lblNewUnitWarning.Name = "lblNewUnitWarning"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
131 this.lblNewUnitWarning.Size = new System.Drawing.Size(312, 32); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
132 this.lblNewUnitWarning.TabIndex = 9; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
133 this.lblNewUnitWarning.Text = "label1"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
134 this.lblNewUnitWarning.TextAlign = System.Drawing.ContentAlignment.TopRight; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
135 this.lblNewUnitWarning.Visible = false; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
136 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
137 // imageList |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
138 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
139 this.imageList.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList.ImageStream"))); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
140 this.imageList.TransparentColor = System.Drawing.Color.Transparent; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
141 this.imageList.Images.SetKeyName(0, ""); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
142 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
143 // lblWarningIcon |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
144 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
145 this.lblWarningIcon.Image = ((System.Drawing.Image)(resources.GetObject("lblWarningIcon.Image"))); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
146 this.lblWarningIcon.Location = new System.Drawing.Point(8, 136); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
147 this.lblWarningIcon.Name = "lblWarningIcon"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
148 this.lblWarningIcon.Size = new System.Drawing.Size(40, 32); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
149 this.lblWarningIcon.TabIndex = 10; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
150 this.lblWarningIcon.Visible = false; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
151 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
152 // FrmNewUnit |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
153 // |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
154 this.AcceptButton = this.bttnSelectUnit; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
155 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
156 this.CancelButton = this.bttnCancel; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
157 this.ClientSize = new System.Drawing.Size(370, 196); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
158 this.Controls.Add(this.lblWarningIcon); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
159 this.Controls.Add(this.lblNewUnitWarning); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
160 this.Controls.Add(this.bttnCancel); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
161 this.Controls.Add(this.lblUnitList); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
162 this.Controls.Add(this.bttnSelectUnit); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
163 this.Controls.Add(this.lstUnits); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
164 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
165 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
166 this.MaximizeBox = false; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
167 this.MinimizeBox = false; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
168 this.Name = "FrmNewUnit"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
169 this.ShowInTaskbar = false; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
170 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
171 this.Text = "FrmNewUni"; |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
172 this.ResumeLayout(false); |
1bcd7ea857c4
* Switch to using a single icon for the FrmNewUnit warning icon to work around Mono vs .Net2 SP2 serialisation bug (https://bugzilla.novell.com/show_bug.cgi?id=360429)
IBBoard <dev@ibboard.co.uk>
parents:
46
diff
changeset
|
173 |
24 | 174 } |
175 #endregion | |
176 | |
177 public UnitType SelectedUnit | |
178 { | |
179 get { return units[lstUnits.SelectedIndex]; } | |
180 } | |
181 | |
182 private void bttnCancel_Click(object sender, System.EventArgs e) | |
183 { | |
184 DialogResult = DialogResult.Cancel; | |
185 this.Close(); | |
186 } | |
187 | |
188 private void bttnSelectUnit_Click(object sender, System.EventArgs e) | |
189 { | |
190 selectUnit(); | |
191 } | |
192 | |
193 private void selectUnit() | |
194 { | |
195 DialogResult = DialogResult.OK; | |
196 this.Close(); | |
197 } | |
198 | |
199 private void setSelectUnitEnabledVal() | |
200 { | |
201 if (lstUnits.SelectedIndex>-1) | |
202 { | |
203 bttnSelectUnit.Enabled = true; | |
204 lblNewUnitWarning.Visible = !allowed[lstUnits.SelectedIndex]; | |
205 lblWarningIcon.Visible = lblNewUnitWarning.Visible; | |
206 | |
207 if (lblNewUnitWarning.Visible) | |
208 { | |
209 //lblNewUnitWarning.Text = army.GetFailedAddRequirement(units[lstUnits.SelectedIndex]).Description; | |
210 //FIXME: Add failed requirement text | |
211 } | |
212 } | |
213 else | |
214 { | |
215 bttnSelectUnit.Enabled = false; | |
216 } | |
217 } | |
218 | |
219 private void lstUnits_SelectedIndexChanged(object sender, System.EventArgs e) | |
220 { | |
221 setSelectUnitEnabledVal(); | |
222 } | |
223 | |
224 private void lstUnits_DoubleClick(object sender, EventArgs e) | |
225 { | |
226 if (lstUnits.SelectedIndex>-1) | |
227 { | |
228 selectUnit(); | |
229 } | |
230 } | |
231 | |
232 private void lstUnits_MouseDown(object sender, MouseEventArgs e) | |
233 { | |
234 //make sure no item is selected when a click is made outside a unit | |
235 int index = lstUnits.IndexFromPoint(e.X, e.Y); | |
236 lstUnits.SelectedIndex = index; | |
237 } | |
238 } | |
239 } |