annotate FrmNewUnit.cs @ 253:7243e6646926 default tip

Re #427: Resizable equipment dialog * Make equipment dialog resizable
author IBBoard <dev@ibboard.co.uk>
date Sat, 27 Apr 2013 16:10:08 +0100
parents 2c3474d652e1
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
1 // This file (FrmNewUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard.
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
2 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
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.
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
4
199
f9ef9b2db496 Re #343: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents: 194
diff changeset
5 using System;
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
6 using System.Collections.Generic;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
7 using System.Drawing;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
8 using System.ComponentModel;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
9 using System.Windows.Forms;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
10 using IBBoard;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
11 using IBBoard.Lang;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
12 using IBBoard.Windows.Forms;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
13 using IBBoard.WarFoundry.API;
194
137ec6d45280 Re #33: Centralised requirement handling
IBBoard <dev@ibboard.co.uk>
parents: 147
diff changeset
14 using IBBoard.WarFoundry.API.Objects;
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
15 using IBBoard.WarFoundry.API.Objects.Requirement;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
16 using IBBoard.Windows.Forms.I18N;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
17
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
18 namespace IBBoard.WarFoundry
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
19 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
20 /// <summary>
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
21 /// Summary description for FrmNewUnit.
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
22 /// </summary>
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
23 public class FrmNewUnit : IBBForm
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
24 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
25 private IBBoard.Windows.Forms.IBBButton bttnCancel;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
26 private IBBoard.Windows.Forms.IBBLabel lblUnitList;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
27 private IBBoard.Windows.Forms.IBBButton bttnSelectUnit;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
28 private System.Windows.Forms.ListBox lstUnits;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
29 private UnitType[] units;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
30 private Army army;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
31 private System.Windows.Forms.Label lblNewUnitWarning;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
32 private System.Windows.Forms.Label lblWarningIcon;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
33
239
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
34 public FrmNewUnit(Race race, Category cat, Army army) : this(army, race.GetUnitTypes(cat))
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
35 {
239
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
36 ControlTranslator.TranslateControl(this, cat.Name);
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
37 }
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
38
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
39 public FrmNewUnit(Army army, UnitType[] unitTypes)
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
40 {
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
41 units = unitTypes;
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
42 this.army = army;
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
43 InitializeComponent();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
44
239
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
45 ControlTranslator.TranslateControl(this);
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
46
239
2c3474d652e1 Re #360: Add WinForms UI for adding contained units
IBBoard <dev@ibboard.co.uk>
parents: 231
diff changeset
47 for (int i = 0; i < units.Length; i++)
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
48 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
49 lstUnits.Items.Add(units[i].Name);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
50 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
51 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
52
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
53 #region Windows Form Designer generated code
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
54 /// <summary>
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
55 /// Required method for Designer support - do not modify
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
56 /// the contents of this method with the code editor.
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
57 /// </summary>
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
58 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
59 {
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
60 System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FrmNewUnit));
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
61 this.lstUnits = new System.Windows.Forms.ListBox();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
62 this.bttnCancel = new IBBoard.Windows.Forms.IBBButton();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
63 this.lblUnitList = new IBBoard.Windows.Forms.IBBLabel();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
64 this.bttnSelectUnit = new IBBoard.Windows.Forms.IBBButton();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
65 this.lblNewUnitWarning = new System.Windows.Forms.Label();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
66 this.lblWarningIcon = new System.Windows.Forms.Label();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
67 this.SuspendLayout();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
68 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
69 // lstUnits
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
70 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
71 this.lstUnits.Location = new System.Drawing.Point(88, 8);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
72 this.lstUnits.Name = "lstUnits";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
73 this.lstUnits.Size = new System.Drawing.Size(272, 121);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
74 this.lstUnits.TabIndex = 7;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
75 this.lstUnits.SelectedIndexChanged += new System.EventHandler(this.lstUnits_SelectedIndexChanged);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
76 this.lstUnits.DoubleClick += new System.EventHandler(this.lstUnits_DoubleClick);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
77 this.lstUnits.MouseDown += new System.Windows.Forms.MouseEventHandler(this.lstUnits_MouseDown);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
78 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
79 // bttnCancel
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
80 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
81 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
82 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
83 this.bttnCancel.Location = new System.Drawing.Point(8, 168);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
84 this.bttnCancel.Name = "bttnCancel";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
85 this.bttnCancel.Size = new System.Drawing.Size(80, 24);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
86 this.bttnCancel.TabIndex = 6;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
87 this.bttnCancel.Text = "Cancel";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
88 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
89 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
90 // lblUnitList
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
91 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
92 this.lblUnitList.Location = new System.Drawing.Point(0, 8);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
93 this.lblUnitList.Name = "lblUnitList";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
94 this.lblUnitList.Size = new System.Drawing.Size(88, 80);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
95 this.lblUnitList.TabIndex = 5;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
96 this.lblUnitList.Text = "unit list";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
97 this.lblUnitList.TextAlign = System.Drawing.ContentAlignment.TopRight;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
98 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
99 // bttnSelectUnit
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
100 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
101 this.bttnSelectUnit.Enabled = false;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
102 this.bttnSelectUnit.FlatStyle = System.Windows.Forms.FlatStyle.System;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
103 this.bttnSelectUnit.Location = new System.Drawing.Point(256, 168);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
104 this.bttnSelectUnit.Name = "bttnSelectUnit";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
105 this.bttnSelectUnit.Size = new System.Drawing.Size(104, 24);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
106 this.bttnSelectUnit.TabIndex = 4;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
107 this.bttnSelectUnit.Text = "create unit";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
108 this.bttnSelectUnit.Click += new System.EventHandler(this.bttnSelectUnit_Click);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
109 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
110 // lblNewUnitWarning
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
111 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
112 this.lblNewUnitWarning.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
113 this.lblNewUnitWarning.Location = new System.Drawing.Point(48, 136);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
114 this.lblNewUnitWarning.Name = "lblNewUnitWarning";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
115 this.lblNewUnitWarning.Size = new System.Drawing.Size(312, 32);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
116 this.lblNewUnitWarning.TabIndex = 9;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
117 this.lblNewUnitWarning.Text = "One or more unit requirements are not satisfied.";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
118 this.lblNewUnitWarning.TextAlign = System.Drawing.ContentAlignment.TopRight;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
119 this.lblNewUnitWarning.Visible = false;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
120 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
121 // lblWarningIcon
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
122 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
123 this.lblWarningIcon.Image = global::IBBoard.WarFoundry.GUI.WinForms.Properties.Resources.dialog_warning;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
124 this.lblWarningIcon.Location = new System.Drawing.Point(8, 136);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
125 this.lblWarningIcon.Name = "lblWarningIcon";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
126 this.lblWarningIcon.Size = new System.Drawing.Size(40, 32);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
127 this.lblWarningIcon.TabIndex = 10;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
128 this.lblWarningIcon.Visible = false;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
129 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
130 // FrmNewUnit
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
131 //
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
132 this.AcceptButton = this.bttnSelectUnit;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
133 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
134 this.CancelButton = this.bttnCancel;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
135 this.ClientSize = new System.Drawing.Size(370, 196);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
136 this.Controls.Add(this.lblWarningIcon);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
137 this.Controls.Add(this.lblNewUnitWarning);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
138 this.Controls.Add(this.bttnCancel);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
139 this.Controls.Add(this.lblUnitList);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
140 this.Controls.Add(this.bttnSelectUnit);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
141 this.Controls.Add(this.lstUnits);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
142 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
143 this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
144 this.MaximizeBox = false;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
145 this.MinimizeBox = false;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
146 this.Name = "FrmNewUnit";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
147 this.ShowInTaskbar = false;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
148 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
149 this.Text = "FrmNewUni";
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
150 this.ResumeLayout(false);
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
151
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
152 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
153 #endregion
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
154
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
155 public UnitType SelectedUnit
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
156 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
157 get { return units[lstUnits.SelectedIndex]; }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
158 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
159
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
160 private void bttnCancel_Click(object sender, System.EventArgs e)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
161 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
162 DialogResult = DialogResult.Cancel;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
163 this.Close();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
164 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
165
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
166 private void bttnSelectUnit_Click(object sender, System.EventArgs e)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
167 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
168 selectUnit();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
169 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
170
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
171 private void selectUnit()
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
172 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
173 DialogResult = DialogResult.OK;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
174 this.Close();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
175 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
176
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
177 private void setSelectUnitEnabledVal()
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
178 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
179 if (lstUnits.SelectedIndex>-1)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
180 {
199
f9ef9b2db496 Re #343: Show unit requirement failures
IBBoard <dev@ibboard.co.uk>
parents: 194
diff changeset
181 bttnSelectUnit.Enabled = true;
231
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
182 ICollection<string> failureMessages;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
183 lblNewUnitWarning.Visible = !Validates.AsOkay(RequirementHandler.AllowsAdding(SelectedUnit, army, out failureMessages));
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
184 lblWarningIcon.Visible = lblNewUnitWarning.Visible;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
185
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
186 if (lblNewUnitWarning.Visible)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
187 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
188 lblNewUnitWarning.Text = String.Join("\n", new List<string>(failureMessages).ToArray());
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
189 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
190 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
191 else
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
192 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
193 bttnSelectUnit.Enabled = false;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
194 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
195 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
196
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
197 private void lstUnits_SelectedIndexChanged(object sender, System.EventArgs e)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
198 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
199 setSelectUnitEnabledVal();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
200 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
201
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
202 private void lstUnits_DoubleClick(object sender, EventArgs e)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
203 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
204 if (lstUnits.SelectedIndex>-1)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
205 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
206 selectUnit();
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
207 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
208 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
209
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
210 private void lstUnits_MouseDown(object sender, MouseEventArgs e)
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
211 {
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
212 //make sure no item is selected when a click is made outside a unit
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
213 int index = lstUnits.IndexFromPoint(e.X, e.Y);
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
214 lstUnits.SelectedIndex = index;
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
215 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
216 }
8021cc097ec8 Re #382: WinForms builds from Linux/Mono fail on Windows/.Net
IBBoard <dev@ibboard.co.uk>
parents: 199
diff changeset
217 }