annotate FrmUnit.cs @ 26:d9aca1dc95d2

* Delete log4net documentation to reduce XML line count on Ohloh no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sun, 05 Jul 2009 09:36:21 +0000
parents 7c366fe55635
children 526fefefb16b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
1 // This file (FrmUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2009 IBBoard.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
2 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
3 // The file and the library/program it is in are licensed under the GNU LGPL license, either version 3 of the License or (at your option) any later version. Please see COPYING.LGPL for more information and the full license.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
4
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
5 using System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
6 using System.Drawing;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
7 using System.Data;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
8 using System.Collections.Generic;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
9 using System.ComponentModel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
10 using System.Windows.Forms;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
11 using IBBoard.Commands;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
12 using IBBoard.Windows.Forms;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
13 using IBBoard.WarFoundry.API;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
14 using IBBoard.WarFoundry.API.Commands;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
15 using IBBoard.WarFoundry.API.Objects;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
16 using IBBoard.WarFoundry.GUI.WinForms.Util;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
17
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
18 namespace IBBoard.WarFoundry
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
19 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
20 ///TODO: Separate weapons out into optional and required, where required only has button for replacing
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
21
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
22 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
23 /// Summary description for FrmUnit.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
24 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
25 public class FrmUnit : IBBoard.Windows.Forms.IBBForm
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
26 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
27 private Unit unit;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
28 private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
29 private CommandStack commandStack;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
30 private System.Windows.Forms.DataGrid statsGrid;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
31 private System.Windows.Forms.TextBox tbUnitName;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
32 private System.Windows.Forms.NumericUpDown unitSize;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
33 private System.Windows.Forms.Label lblUnitSize;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
34 private System.Windows.Forms.Button bttnAddWeapon;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
35 private System.Windows.Forms.Button bttnRemoveWeapon;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
36 private System.Windows.Forms.Button bttnEditWeapon;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
37 private System.Windows.Forms.Label lblRequiredEquip;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
38 private System.Windows.Forms.ListBox reqdList;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
39 private System.Windows.Forms.ListBox optList;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
40 private System.Windows.Forms.Label lblOptionalEquip;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
41 private System.Windows.Forms.Button bttnReplaceWeapon;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
42 private System.Windows.Forms.Button bttnEditReqdWeapon;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
43 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
44 /// Required designer variable.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
45 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
46 private System.ComponentModel.Container components = null;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
47
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
48 public FrmUnit(Unit toDisplay, CommandStack cmdStack)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
49 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
50 unit = toDisplay;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
51 commandStack = cmdStack;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
52 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
53 // Required for Windows Form Designer support
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
54 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
55 InitializeComponent();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
56
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
57 tbUnitName.Text = unit.Name;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
58 Text = unit.Name;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
59 unit.NameChanged+=new StringValChangedDelegate(unit_NameChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
60 unit.UnitSizeChanged+= new IntValChangedDelegate(unit_UnitSizeChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
61 unit.UnitEquipmentAmountChanged+=new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
62
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
63 if (unit.UnitType.MaxSize==unit.UnitType.MinSize)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
64 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
65 unitSize.Value = unit.UnitType.MaxSize;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
66 unitSize.Visible = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
67 lblUnitSize.Visible = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
68 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
69 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
70 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
71 unitSize.Value = unit.Size;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
72 unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
73 unitSize.Minimum = unit.UnitType.MinSize;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
74 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
75
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
76 SetStats();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
77 SetWeapons();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
78 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
79
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
80 private void SetStats()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
81 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
82 DataTable dt = new DataTable();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
83 Stat[] stats = unit.UnitStatsArrayWithName;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
84 DataColumn[] dc = new DataColumn[stats.Length+1];
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
85 dc[0] = new DataColumn("name");
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
86
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
87 DataGridTableStyle dgStyle = new DataGridTableStyle();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
88 dgStyle.RowHeadersVisible = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
89
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
90 DataGridTextBoxColumn colStyle = new DataGridTextBoxColumn();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
91 colStyle.Width = statsGrid.ClientSize.Width - (stats.Length * 40) - 4;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
92 colStyle.MappingName = "name";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
93 colStyle.HeaderText = "name";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
94 colStyle.ReadOnly = true;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
95 dgStyle.GridColumnStyles.Add(colStyle);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
96
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
97 DataColumn tempCol;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
98 int i = 1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
99
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
100 foreach (Stat stat in stats)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
101 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
102 tempCol = new DataColumn(stat.ParentSlotName);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
103 dc[i] = tempCol;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
104 colStyle = new DataGridTextBoxColumn();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
105 colStyle.Alignment = HorizontalAlignment.Center;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
106 colStyle.Width = 40;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
107 colStyle.MappingName = stat.ParentSlotName;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
108 colStyle.HeaderText = stat.ParentSlotName;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
109 colStyle.ReadOnly = true;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
110 dgStyle.GridColumnStyles.Add(colStyle);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
111 i++;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
112 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
113
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
114 dt.Columns.AddRange(dc);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
115
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
116 DataRow dr = dt.NewRow();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
117 dr.ItemArray = unit.UnitStatsArrayWithName;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
118 dt.Rows.Add(dr);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
119 statsGrid.DataSource = dt;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
120 statsGrid.TableStyles.Add(dgStyle);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
121 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
122
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
123 private void SetWeapons()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
124 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
125 foreach(UnitEquipmentItem item in unit.GetEquipment())
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
126 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
127 if (item.IsRequired)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
128 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
129 reqdList.Items.Add(GetEquipmentChoice(item));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
130 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
131 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
132 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
133 optList.Items.Add(GetEquipmentChoice(item));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
134 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
135 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
136 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
137
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
138 private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
139 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
140 UnitEquipmentChoice choice = null;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
141 equipmentChoices.TryGetValue(item, out choice);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
142
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
143 if (choice == null)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
144 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
145 choice = new UnitEquipmentChoice(Unit, item);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
146 equipmentChoices[item] = choice;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
147 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
148
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
149 return choice;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
150 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
151
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
152 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
153 /// Clean up any resources being used.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
154 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
155 protected override void Dispose( bool disposing )
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
156 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
157 //remove our leave events so that disposing doesn't trigger them
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
158 tbUnitName.Leave-= new System.EventHandler(this.tbUnitName_Leave);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
159 unitSize.Leave-= new System.EventHandler(this.unitSize_Leave);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
160
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
161 if( disposing )
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
162 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
163 if(components != null)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
164 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
165 components.Dispose();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
166 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
167 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
168 base.Dispose( disposing );
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
169 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
170
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
171 #region Windows Form Designer generated code
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
172 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
173 /// Required method for Designer support - do not modify
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
174 /// the contents of this method with the code editor.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
175 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
176 private void InitializeComponent()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
177 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
178 this.statsGrid = new System.Windows.Forms.DataGrid();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
179 this.tbUnitName = new System.Windows.Forms.TextBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
180 this.unitSize = new System.Windows.Forms.NumericUpDown();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
181 this.lblUnitSize = new System.Windows.Forms.Label();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
182 this.lblRequiredEquip = new System.Windows.Forms.Label();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
183 this.bttnAddWeapon = new System.Windows.Forms.Button();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
184 this.bttnRemoveWeapon = new System.Windows.Forms.Button();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
185 this.reqdList = new System.Windows.Forms.ListBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
186 this.bttnEditWeapon = new System.Windows.Forms.Button();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
187 this.optList = new System.Windows.Forms.ListBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
188 this.lblOptionalEquip = new System.Windows.Forms.Label();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
189 this.bttnReplaceWeapon = new System.Windows.Forms.Button();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
190 this.bttnEditReqdWeapon = new System.Windows.Forms.Button();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
191 ((System.ComponentModel.ISupportInitialize)(this.statsGrid)).BeginInit();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
192 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
193 this.SuspendLayout();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
194 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
195 // statsGrid
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
196 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
197 this.statsGrid.AllowNavigation = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
198 this.statsGrid.AllowSorting = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
199 this.statsGrid.AlternatingBackColor = System.Drawing.SystemColors.Control;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
200 this.statsGrid.BackgroundColor = System.Drawing.SystemColors.Control;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
201 this.statsGrid.CaptionVisible = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
202 this.statsGrid.DataMember = "";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
203 this.statsGrid.GridLineColor = System.Drawing.SystemColors.ControlDarkDark;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
204 this.statsGrid.HeaderForeColor = System.Drawing.SystemColors.ControlText;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
205 this.statsGrid.Location = new System.Drawing.Point(8, 32);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
206 this.statsGrid.Name = "statsGrid";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
207 this.statsGrid.PreferredColumnWidth = 40;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
208 this.statsGrid.ReadOnly = true;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
209 this.statsGrid.RowHeadersVisible = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
210 this.statsGrid.SelectionBackColor = System.Drawing.SystemColors.Control;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
211 this.statsGrid.SelectionForeColor = System.Drawing.SystemColors.WindowText;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
212 this.statsGrid.Size = new System.Drawing.Size(600, 88);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
213 this.statsGrid.TabIndex = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
214 this.statsGrid.TabStop = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
215 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
216 // tbUnitName
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
217 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
218 this.tbUnitName.Location = new System.Drawing.Point(8, 8);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
219 this.tbUnitName.Name = "tbUnitName";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
220 this.tbUnitName.Size = new System.Drawing.Size(344, 20);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
221 this.tbUnitName.TabIndex = 1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
222 this.tbUnitName.Text = "";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
223 this.tbUnitName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbUnitName_KeyDown);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
224 this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
225 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
226 // unitSize
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
227 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
228 this.unitSize.Location = new System.Drawing.Point(528, 8);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
229 this.unitSize.Name = "unitSize";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
230 this.unitSize.Size = new System.Drawing.Size(80, 20);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
231 this.unitSize.TabIndex = 1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
232 this.unitSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
233 this.unitSize.Value = new System.Decimal(new int[] {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
234 1,
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
235 0,
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
236 0,
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
237 0});
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
238 this.unitSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unitSize_KeyDown);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
239 this.unitSize.Leave += new System.EventHandler(this.unitSize_Leave);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
240 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
241 // lblUnitSize
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
242 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
243 this.lblUnitSize.Location = new System.Drawing.Point(424, 8);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
244 this.lblUnitSize.Name = "lblUnitSize";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
245 this.lblUnitSize.TabIndex = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
246 this.lblUnitSize.Text = "unit size";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
247 this.lblUnitSize.TextAlign = System.Drawing.ContentAlignment.TopRight;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
248 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
249 // lblRequiredEquip
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
250 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
251 this.lblRequiredEquip.Location = new System.Drawing.Point(8, 128);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
252 this.lblRequiredEquip.Name = "lblRequiredEquip";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
253 this.lblRequiredEquip.Size = new System.Drawing.Size(88, 32);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
254 this.lblRequiredEquip.TabIndex = 3;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
255 this.lblRequiredEquip.Text = "reqd equipment";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
256 this.lblRequiredEquip.TextAlign = System.Drawing.ContentAlignment.TopRight;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
257 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
258 // bttnAddWeapon
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
259 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
260 this.bttnAddWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
261 this.bttnAddWeapon.Location = new System.Drawing.Point(520, 200);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
262 this.bttnAddWeapon.Name = "bttnAddWeapon";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
263 this.bttnAddWeapon.Size = new System.Drawing.Size(88, 22);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
264 this.bttnAddWeapon.TabIndex = 4;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
265 this.bttnAddWeapon.Text = "add";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
266 this.bttnAddWeapon.Click += new System.EventHandler(this.bttnAddWeapon_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
267 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
268 // bttnRemoveWeapon
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
269 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
270 this.bttnRemoveWeapon.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
271 this.bttnRemoveWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
272 this.bttnRemoveWeapon.Location = new System.Drawing.Point(520, 248);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
273 this.bttnRemoveWeapon.Name = "bttnRemoveWeapon";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
274 this.bttnRemoveWeapon.Size = new System.Drawing.Size(88, 22);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
275 this.bttnRemoveWeapon.TabIndex = 5;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
276 this.bttnRemoveWeapon.Text = "remove";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
277 this.bttnRemoveWeapon.Click += new System.EventHandler(this.bttnRemoveWeapon_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
278 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
279 // reqdList
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
280 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
281 this.reqdList.Location = new System.Drawing.Point(104, 128);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
282 this.reqdList.Name = "reqdList";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
283 this.reqdList.Size = new System.Drawing.Size(408, 69);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
284 this.reqdList.TabIndex = 6;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
285 this.reqdList.DoubleClick += new System.EventHandler(this.reqdList_DoubleClick);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
286 this.reqdList.SelectedIndexChanged += new System.EventHandler(this.reqdList_SelectedIndexChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
287 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
288 // bttnEditWeapon
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
289 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
290 this.bttnEditWeapon.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
291 this.bttnEditWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
292 this.bttnEditWeapon.Location = new System.Drawing.Point(520, 224);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
293 this.bttnEditWeapon.Name = "bttnEditWeapon";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
294 this.bttnEditWeapon.Size = new System.Drawing.Size(88, 22);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
295 this.bttnEditWeapon.TabIndex = 7;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
296 this.bttnEditWeapon.Text = "edit";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
297 this.bttnEditWeapon.Click += new System.EventHandler(this.bttnEditWeapon_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
298 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
299 // optList
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
300 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
301 this.optList.Location = new System.Drawing.Point(104, 200);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
302 this.optList.Name = "optList";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
303 this.optList.Size = new System.Drawing.Size(408, 69);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
304 this.optList.TabIndex = 9;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
305 this.optList.DoubleClick += new System.EventHandler(this.optList_DoubleClick);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
306 this.optList.SelectedIndexChanged += new System.EventHandler(this.optList_SelectedIndexChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
307 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
308 // lblOptionalEquip
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
309 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
310 this.lblOptionalEquip.Location = new System.Drawing.Point(8, 200);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
311 this.lblOptionalEquip.Name = "lblOptionalEquip";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
312 this.lblOptionalEquip.Size = new System.Drawing.Size(88, 32);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
313 this.lblOptionalEquip.TabIndex = 8;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
314 this.lblOptionalEquip.Text = "opt equipment";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
315 this.lblOptionalEquip.TextAlign = System.Drawing.ContentAlignment.TopRight;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
316 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
317 // bttnReplaceWeapon
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
318 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
319 this.bttnReplaceWeapon.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
320 this.bttnReplaceWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
321 this.bttnReplaceWeapon.Location = new System.Drawing.Point(520, 128);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
322 this.bttnReplaceWeapon.Name = "bttnReplaceWeapon";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
323 this.bttnReplaceWeapon.Size = new System.Drawing.Size(88, 22);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
324 this.bttnReplaceWeapon.TabIndex = 10;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
325 this.bttnReplaceWeapon.Text = "replace";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
326 this.bttnReplaceWeapon.Click += new System.EventHandler(this.bttnReplaceWeapon_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
327 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
328 // bttnEditReqdWeapon
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
329 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
330 this.bttnEditReqdWeapon.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
331 this.bttnEditReqdWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
332 this.bttnEditReqdWeapon.Location = new System.Drawing.Point(520, 152);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
333 this.bttnEditReqdWeapon.Name = "bttnEditReqdWeapon";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
334 this.bttnEditReqdWeapon.Size = new System.Drawing.Size(88, 22);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
335 this.bttnEditReqdWeapon.TabIndex = 11;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
336 this.bttnEditReqdWeapon.Text = "edit";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
337 this.bttnEditReqdWeapon.Click += new System.EventHandler(this.bttnEditReqdWeapon_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
338 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
339 // FrmUnit
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
340 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
341 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
342 this.ClientSize = new System.Drawing.Size(616, 314);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
343 this.Controls.Add(this.bttnEditReqdWeapon);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
344 this.Controls.Add(this.bttnReplaceWeapon);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
345 this.Controls.Add(this.optList);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
346 this.Controls.Add(this.lblOptionalEquip);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
347 this.Controls.Add(this.bttnEditWeapon);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
348 this.Controls.Add(this.reqdList);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
349 this.Controls.Add(this.bttnRemoveWeapon);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
350 this.Controls.Add(this.bttnAddWeapon);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
351 this.Controls.Add(this.lblRequiredEquip);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
352 this.Controls.Add(this.lblUnitSize);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
353 this.Controls.Add(this.unitSize);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
354 this.Controls.Add(this.tbUnitName);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
355 this.Controls.Add(this.statsGrid);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
356 this.Name = "FrmUnit";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
357 this.ShowInTaskbar = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
358 this.Text = "FrmUnit";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
359 ((System.ComponentModel.ISupportInitialize)(this.statsGrid)).EndInit();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
360 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).EndInit();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
361 this.ResumeLayout(false);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
362
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
363 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
364 #endregion
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
365
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
366 public Unit Unit
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
367 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
368 get { return unit; }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
369 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
370
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
371 private void tbUnitName_Leave(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
372 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
373 updateUnitName();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
374 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
375
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
376 private void tbUnitName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
377 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
378 if (e.KeyCode == Keys.Enter)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
379 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
380 updateUnitName();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
381 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
382 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
383
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
384 private void updateUnitName()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
385 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
386 if (unit.Name!=tbUnitName.Text)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
387 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
388 commandStack.Execute(new SetNameCommand(unit, tbUnitName.Text));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
389 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
390 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
391
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
392 private void unitSize_Leave(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
393 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
394 updateUnitSize();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
395 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
396
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
397 private void unitSize_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
398 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
399 if (e.KeyCode == Keys.Enter)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
400 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
401 updateUnitSize();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
402 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
403 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
404
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
405 private void updateUnitSize()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
406 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
407 if (unit.Size!=unitSize.Value)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
408 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
409 commandStack.Execute(new SetUnitSizeCommand(unit, (int)unitSize.Value));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
410 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
411 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
412
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
413 private void unit_NameChanged(WarFoundryObject obj, string oldValue, string newValue)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
414 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
415 if (obj is Unit && obj.Equals(unit))
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
416 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
417 Unit u = (Unit)obj;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
418 tbUnitName.Text = obj.Name;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
419 Text = obj.Name;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
420 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
421 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
422
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
423 private void unit_UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
424 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
425 if (obj is Unit && obj.Equals(unit))
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
426 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
427 unitSize.Value = newValue;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
428 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
429 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
430
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
431 private void reqdList_SelectedIndexChanged(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
432 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
433 bttnReplaceWeapon.Enabled = (reqdList.SelectedIndex>-1 && ((UnitEquipmentChoice)reqdList.SelectedItem).Item.HasAlternatives());
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
434 bttnEditReqdWeapon.Enabled = (reqdList.SelectedIndex>-1);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
435 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
436
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
437 private void optList_SelectedIndexChanged(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
438 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
439 bttnEditWeapon.Enabled = optList.SelectedIndex>-1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
440 bttnRemoveWeapon.Enabled = bttnEditWeapon.Enabled;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
441 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
442
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
443 private void unit_UnitEquipmentAmountChanged(WarFoundryObject obj, double oldValue, double newValue)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
444 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
445 if (obj is UnitEquipmentItem)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
446 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
447 UnitEquipmentItem equip = (UnitEquipmentItem)obj;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
448 ListBox weaponList = (equip.IsRequired ? reqdList : optList);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
449
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
450 if (newValue==0)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
451 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
452 weaponList.Items.Remove(GetEquipmentChoice(equip));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
453 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
454 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
455 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
456 UnitEquipmentChoice equipObj = GetEquipmentChoice(equip);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
457 int idx = weaponList.Items.IndexOf(equipObj);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
458
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
459 if (idx>-1)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
460 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
461 weaponList.Items[idx] = equipObj;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
462 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
463 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
464 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
465 weaponList.Items.Add(equipObj);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
466 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
467 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
468 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
469 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
470
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
471 private void editWeapon(ListBox list)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
472 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
473 FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, ((UnitEquipmentChoice)list.SelectedItem).Item, commandStack);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
474 editEquip.ShowDialog(this);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
475 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
476
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
477 private void bttnEditWeapon_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
478 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
479 editWeapon(optList);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
480 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
481
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
482 private void optList_DoubleClick(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
483 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
484 editWeapon(optList);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
485 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
486
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
487 private void reqdList_DoubleClick(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
488 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
489 editWeapon(reqdList);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
490 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
491
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
492 private void addWeapon()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
493 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
494 FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
495 newEquip.ShowDialog(this);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
496 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
497
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
498 private void bttnAddWeapon_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
499 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
500 addWeapon();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
501 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
502
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
503 private void removeWeapon()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
504 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
505 commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, ((UnitEquipmentChoice)optList.SelectedItem).Item, 0));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
506 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
507
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
508 private void bttnRemoveWeapon_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
509 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
510 removeWeapon();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
511 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
512
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
513 private void bttnEditReqdWeapon_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
514 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
515 editWeapon(reqdList);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
516 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
517
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
518 private void bttnReplaceWeapon_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
519 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
520 FrmReplaceUnitEquipment replace = new FrmReplaceUnitEquipment(unit, ((UnitEquipmentChoice)reqdList.SelectedItem).Item, commandStack);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
521 replace.ShowDialog(this);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
522 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
523 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 16
diff changeset
524 }