annotate FrmUnit.cs @ 238:55c94d438a4b

Re #58: Remove LogNotifier from API * Add logging moved from API
author IBBoard <dev@ibboard.co.uk>
date Sat, 17 Mar 2012 21:03:33 +0000
parents 72beddaffb71
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
193
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
1 // This file (FrmUnit.cs) is a part of the IBBoard.WarFoundry.GUI.WinForms project and is copyright 2007, 2008, 2009 IBBoard.
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
2 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
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.
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
4
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
5 using System;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
6 using System.Drawing;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
7 using System.Data;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
8 using System.Collections.Generic;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
9 using System.ComponentModel;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
10 using System.Windows.Forms;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
11 using IBBoard.Commands;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
12 using IBBoard.Lang;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
13 using IBBoard.Windows.Forms;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
14 using IBBoard.Windows.Forms.I18N;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
15 using IBBoard.WarFoundry.API;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
16 using IBBoard.WarFoundry.API.Commands;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
17 using IBBoard.WarFoundry.API.Objects;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
18 using IBBoard.WarFoundry.GUI.WinForms.UI;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
19 using IBBoard.WarFoundry.GUI.WinForms.Util;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
20 using log4net;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
21
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
22 namespace IBBoard.WarFoundry.GUI.WinForms
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
23 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
24 /// <summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
25 /// Summary description for FrmUnit.
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
26 /// </summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
27 public class FrmUnit : IBBoard.Windows.Forms.IBBForm
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
28 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
29 private static readonly ILog log = LogManager.GetLogger(typeof(FrmUnit));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
30 private static readonly int NAME_COL_WIDTH_MULTIPLIER = 3;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
31 private Unit unit;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
32 private Dictionary<UnitEquipmentItem, UnitEquipmentChoice> equipmentChoices = new Dictionary<UnitEquipmentItem, UnitEquipmentChoice>();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
33 private Dictionary<string, DataGridView> DataGridViews = new Dictionary<string, DataGridView>();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
34 private CommandStack commandStack;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
35 private System.Windows.Forms.TextBox tbUnitName;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
36 private System.Windows.Forms.NumericUpDown unitSize;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
37 private IBBLabel lblUnitSize;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
38 private IBBButton bttnAddWeapon;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
39 private IBBButton bttnRemoveWeapon;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
40 private IBBLabel lblEquip;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
41 private System.Windows.Forms.ListBox equipmentList;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
42 private IBBButton bttnReplaceWeapon;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
43 private IBBButton bttnEditWeapon;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
44 private Label lblPoints;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
45 private IBBLabel lblNotes;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
46 private TextBox notes;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
47 private ListBox abilitiesList;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
48 private IBBLabel lblAbilities;
190
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 166
diff changeset
49 private FlowLayoutPanel statsPanel;
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 166
diff changeset
50 public GameSystem CurrentGameSystem
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 166
diff changeset
51 {
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 166
diff changeset
52 get { return WarFoundryCore.CurrentGameSystem; }
1ca23c47345a Re #327: Point names used in the GUI
snowblizz
parents: 166
diff changeset
53 set { WarFoundryCore.CurrentGameSystem = value; }
193
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
54 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
55
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
56 /// <summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
57 /// Required designer variable.
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
58 /// </summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
59 private System.ComponentModel.Container components = null;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
60
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
61 public FrmUnit(Unit toDisplay, CommandStack cmdStack)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
62 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
63 unit = toDisplay;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
64 commandStack = cmdStack;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
65 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
66 // Required for Windows Form Designer support
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
67 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
68 InitializeComponent();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
69 TranslateForm();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
70 Translation.TranslationChanged += new MethodInvoker(TranslateForm);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
71 unit.NameChanged += new StringValChangedDelegate(unit_NameChanged);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
72 unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
73 unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
74 unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
75
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
76 unitSize.Value = unit.Size;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
77 unitSize.Maximum = (unit.UnitType.MaxSize == WarFoundryCore.INFINITY ? int.MaxValue : unit.UnitType.MaxSize);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
78 unitSize.Minimum = unit.UnitType.MinSize;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
79 unitSize.Enabled = (unitSize.Maximum != unitSize.Minimum);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
80
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
81 notes.Text = unit.UnitType.Notes;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
82 abilitiesList.DataSource = new List<Ability>(unit.UnitType.GetRequiredAbilities());
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
83 abilitiesList.DisplayMember = "Name";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
84 SetPointsValueText();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
85 SetStats();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
86 SetWeapons();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
87 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
88
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
89 private void TranslateForm()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
90 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
91 ControlTranslator.TranslateControl(this);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
92 SetUnitName();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
93 RefreshUnitEquipment();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
94 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
95
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
96 private void SetUnitName()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
97 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
98 tbUnitName.Text = unit.Name;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
99 Text = Translation.GetTranslation("FrmUnit", "{0} ({1})", unit.Name, unit.UnitType.Name);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
100 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
101
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
102 void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
103 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
104 SetPointsValueText();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
105 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
106
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
107 private void SetPointsValueText()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
108 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
109 lblPoints.Text = Translation.GetTranslation("FrmUnitlblPoints", "(" + unit.Points + " pts)", unit.Points, CurrentGameSystem.GetPointsAbbrev(unit.Points));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
110 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
111
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
112 private void SetStats()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
113 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
114 Stat[][] stats = unit.UnitStatsArraysWithName;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
115 string[] statsIDs = unit.UnitStatsArrayIDs;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
116 int statsCount = stats.Length;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
117 log.DebugFormat("Unit {0} has {1} stats arrays", unit.UnitType.Name, statsCount);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
118
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
119 for (int i = 0; i < statsCount; i++)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
120 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
121 DataGridView statsGrid = GetDataGridView(statsIDs[i]);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
122 DataTable dt = (DataTable)statsGrid.DataSource;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
123 DataRow dr = dt.NewRow();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
124 dr.ItemArray = stats[i];
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
125 log.DebugFormat("Add row to data table for {0}", statsIDs[i]);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
126 dt.Rows.Add(dr);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
127 statsGrid.ClearSelection();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
128 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
129 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
130
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
131 private DataGridView GetDataGridView(string statsID)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
132 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
133 DataGridView grid;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
134
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
135 if (DataGridViews.ContainsKey(statsID))
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
136 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
137 grid = DictionaryUtils.GetValue(DataGridViews, statsID);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
138 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
139 else
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
140 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
141 grid = CreateDataGridView(statsID);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
142 DataGridViews[statsID] = grid;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
143 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
144
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
145 return grid;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
146 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
147
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
148 private DataGridView CreateDataGridView(string statsID)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
149 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
150 log.DebugFormat("Create DataGridView for stats ID {0}", statsID);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
151 SystemStats sysStats = unit.Race.GameSystem.GetSystemStatsForID(statsID);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
152 StatSlot[] sysStatSlots = sysStats.StatSlots;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
153 int statsCount = sysStatSlots.Length;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
154 int statsWithNameCount = statsCount + 1;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
155 StatSlot[] statsWithName = new StatSlot[statsWithNameCount];
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
156 statsWithName[0] = new StatSlot("Name");
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
157 sysStatSlots.CopyTo(statsWithName, 1);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
158 DataTable dt = new DataTable();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
159 DataGridView statsGrid = CreateDataGridView();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
160 statsGrid.DataSource = dt;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
161 int columnWidth = statsGrid.Width / (statsCount + NAME_COL_WIDTH_MULTIPLIER);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
162
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
163 for (int i = 0; i < statsWithNameCount; i++)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
164 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
165 StatSlot stat = statsWithName[i];
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
166 string slotName = stat.Name;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
167 statsGrid.Columns.Add(CreateStatColumn(slotName, columnWidth));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
168 dt.Columns.Add(CreateDataColumn(slotName));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
169 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
170
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
171 int otherStatsWidth = statsCount * columnWidth;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
172 SetNameColumnWidth(statsGrid, otherStatsWidth);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
173
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
174 return statsGrid;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
175 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
176
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
177 private static DataGridViewColumn CreateStatColumn(string slotName, int columnWidth)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
178 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
179 DataGridViewColumn col = new DataGridViewTextBoxColumn();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
180 col.Width = columnWidth;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
181 col.Name = slotName;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
182 col.HeaderText = slotName;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
183 col.DataPropertyName = slotName;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
184 col.SortMode = DataGridViewColumnSortMode.NotSortable;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
185 col.CellTemplate = new StatsDataGridViewCell();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
186 col.HeaderCell.Style.WrapMode = DataGridViewTriState.False;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
187 return col;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
188 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
189
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
190 private static void SetNameColumnWidth(DataGridView statsGrid, int otherStatsWidth)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
191 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
192
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
193 DataGridViewColumn nameColumn = statsGrid.Columns[0];
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
194 nameColumn.HeaderText = Translation.GetTranslation("StatLineName", "name");
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
195 nameColumn.Width = statsGrid.Width - otherStatsWidth;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
196 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
197
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
198 private static DataColumn CreateDataColumn(string slotName)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
199 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
200 log.DebugFormat("Create column {0}", slotName);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
201 DataColumn tempCol = new DataColumn(slotName, typeof(Stat));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
202 return tempCol;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
203 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
204
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
205 public DataGridView CreateDataGridView()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
206 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
207 log.Debug("Create DataGridView widget");
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
208 DataGridView statsGrid = new DataGridView();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
209 statsGrid.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
210 | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
211 statsGrid.CausesValidation = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
212 statsGrid.ReadOnly = true;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
213 statsGrid.RowHeadersVisible = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
214 statsGrid.Size = new System.Drawing.Size(600, 88);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
215 statsGrid.TabStop = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
216 statsGrid.AllowUserToAddRows = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
217 statsGrid.ScrollBars = ScrollBars.None;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
218 statsGrid.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.DisableResizing;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
219 statsGrid.BorderStyle = BorderStyle.None;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
220 statsGrid.BackgroundColor = SystemColors.Control;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
221 statsGrid.RowsAdded += new DataGridViewRowsAddedEventHandler(statsGrid_RowsAdded);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
222 statsPanel.Controls.Add(statsGrid);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
223 statsGrid.Width = statsPanel.Width - (int)Math.Round(SystemInformation.VerticalScrollBarWidth * 1.4);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
224 return statsGrid;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
225 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
226
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
227 private void statsGrid_RowsAdded(object sender, DataGridViewRowsAddedEventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
228 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
229 if (sender is DataGridView)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
230 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
231 SetGridHeight((DataGridView)sender);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
232 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
233 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
234
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
235 private static void SetGridHeight(DataGridView statsGrid)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
236 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
237 DataGridViewRowCollection rows = statsGrid.Rows;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
238 statsGrid.Height = statsGrid.Columns[0].HeaderCell.Size.Height + (rows.Count * rows[0].Height);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
239 log.DebugFormat("Set height to {0} for grid of {1} rows", statsGrid.Height, rows.Count);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
240 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
241
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
242 private void SetWeapons()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
243 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
244 foreach (UnitEquipmentItem item in unit.GetEquipment())
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
245 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
246 equipmentList.Items.Add(GetEquipmentChoice(item));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
247 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
248 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
249
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
250 private UnitEquipmentChoice GetEquipmentChoice(UnitEquipmentItem item)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
251 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
252 UnitEquipmentChoice choice = null;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
253 equipmentChoices.TryGetValue(item, out choice);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
254
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
255 if (choice == null)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
256 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
257 choice = new UnitEquipmentChoice(Unit, item);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
258 equipmentChoices[item] = choice;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
259 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
260
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
261 return choice;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
262 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
263
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
264 /// <summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
265 /// Clean up any resources being used.
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
266 /// </summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
267 protected override void Dispose(bool disposing)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
268 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
269 //remove our leave events so that disposing doesn't trigger them
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
270 tbUnitName.Leave -= new System.EventHandler(this.tbUnitName_Leave);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
271 unitSize.Leave -= new System.EventHandler(this.unitSize_Leave);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
272
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
273 if (disposing)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
274 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
275 if (components != null)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
276 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
277 components.Dispose();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
278 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
279 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
280 base.Dispose(disposing);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
281 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
282
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
283 #region Windows Form Designer generated code
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
284 /// <summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
285 /// Required method for Designer support - do not modify
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
286 /// the contents of this method with the code editor.
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
287 /// </summary>
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
288 private void InitializeComponent()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
289 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
290 this.tbUnitName = new System.Windows.Forms.TextBox();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
291 this.unitSize = new System.Windows.Forms.NumericUpDown();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
292 this.lblUnitSize = new IBBoard.Windows.Forms.IBBLabel();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
293 this.lblEquip = new IBBoard.Windows.Forms.IBBLabel();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
294 this.bttnAddWeapon = new IBBoard.Windows.Forms.IBBButton();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
295 this.bttnRemoveWeapon = new IBBoard.Windows.Forms.IBBButton();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
296 this.equipmentList = new System.Windows.Forms.ListBox();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
297 this.bttnReplaceWeapon = new IBBoard.Windows.Forms.IBBButton();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
298 this.bttnEditWeapon = new IBBoard.Windows.Forms.IBBButton();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
299 this.lblPoints = new System.Windows.Forms.Label();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
300 this.lblNotes = new IBBoard.Windows.Forms.IBBLabel();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
301 this.notes = new System.Windows.Forms.TextBox();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
302 this.abilitiesList = new System.Windows.Forms.ListBox();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
303 this.lblAbilities = new IBBoard.Windows.Forms.IBBLabel();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
304 this.statsPanel = new System.Windows.Forms.FlowLayoutPanel();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
305 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
306 this.SuspendLayout();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
307 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
308 // tbUnitName
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
309 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
310 this.tbUnitName.Location = new System.Drawing.Point(8, 8);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
311 this.tbUnitName.Name = "tbUnitName";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
312 this.tbUnitName.Size = new System.Drawing.Size(344, 20);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
313 this.tbUnitName.TabIndex = 1;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
314 this.tbUnitName.KeyDown += new System.Windows.Forms.KeyEventHandler(this.tbUnitName_KeyDown);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
315 this.tbUnitName.Leave += new System.EventHandler(this.tbUnitName_Leave);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
316 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
317 // unitSize
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
318 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
319 this.unitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
320 this.unitSize.Location = new System.Drawing.Point(528, 8);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
321 this.unitSize.Name = "unitSize";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
322 this.unitSize.Size = new System.Drawing.Size(80, 20);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
323 this.unitSize.TabIndex = 1;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
324 this.unitSize.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
325 this.unitSize.Value = new decimal(new int[] {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
326 1,
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
327 0,
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
328 0,
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
329 0});
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
330 this.unitSize.Leave += new System.EventHandler(this.unitSize_Leave);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
331 this.unitSize.KeyDown += new System.Windows.Forms.KeyEventHandler(this.unitSize_KeyDown);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
332 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
333 // lblUnitSize
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
334 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
335 this.lblUnitSize.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
336 this.lblUnitSize.Location = new System.Drawing.Point(426, 8);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
337 this.lblUnitSize.Name = "lblUnitSize";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
338 this.lblUnitSize.Size = new System.Drawing.Size(98, 23);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
339 this.lblUnitSize.TabIndex = 0;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
340 this.lblUnitSize.Text = "unit size";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
341 this.lblUnitSize.TextAlign = System.Drawing.ContentAlignment.TopRight;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
342 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
343 // lblEquip
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
344 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
345 this.lblEquip.Location = new System.Drawing.Point(15, 126);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
346 this.lblEquip.Name = "lblEquip";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
347 this.lblEquip.Size = new System.Drawing.Size(81, 108);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
348 this.lblEquip.TabIndex = 3;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
349 this.lblEquip.Text = "equipment";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
350 this.lblEquip.TextAlign = System.Drawing.ContentAlignment.TopRight;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
351 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
352 // bttnAddWeapon
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
353 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
354 this.bttnAddWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
355 this.bttnAddWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
356 this.bttnAddWeapon.Location = new System.Drawing.Point(516, 126);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
357 this.bttnAddWeapon.Name = "bttnAddWeapon";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
358 this.bttnAddWeapon.Size = new System.Drawing.Size(88, 22);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
359 this.bttnAddWeapon.TabIndex = 4;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
360 this.bttnAddWeapon.Text = "add";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
361 this.bttnAddWeapon.Click += new System.EventHandler(this.bttnAddWeapon_Click);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
362 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
363 // bttnRemoveWeapon
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
364 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
365 this.bttnRemoveWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
366 this.bttnRemoveWeapon.Enabled = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
367 this.bttnRemoveWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
368 this.bttnRemoveWeapon.Location = new System.Drawing.Point(516, 210);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
369 this.bttnRemoveWeapon.Name = "bttnRemoveWeapon";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
370 this.bttnRemoveWeapon.Size = new System.Drawing.Size(88, 22);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
371 this.bttnRemoveWeapon.TabIndex = 5;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
372 this.bttnRemoveWeapon.Text = "remove";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
373 this.bttnRemoveWeapon.Click += new System.EventHandler(this.bttnRemoveWeapon_Click);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
374 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
375 // equipmentList
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
376 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
377 this.equipmentList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
378 | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
379 this.equipmentList.Location = new System.Drawing.Point(102, 126);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
380 this.equipmentList.Name = "equipmentList";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
381 this.equipmentList.Size = new System.Drawing.Size(408, 108);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
382 this.equipmentList.TabIndex = 6;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
383 this.equipmentList.SelectedIndexChanged += new System.EventHandler(this.equipmentList_SelectedIndexChanged);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
384 this.equipmentList.DoubleClick += new System.EventHandler(this.equipmentList_DoubleClick);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
385 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
386 // bttnReplaceWeapon
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
387 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
388 this.bttnReplaceWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
389 this.bttnReplaceWeapon.Enabled = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
390 this.bttnReplaceWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
391 this.bttnReplaceWeapon.Location = new System.Drawing.Point(516, 182);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
392 this.bttnReplaceWeapon.Name = "bttnReplaceWeapon";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
393 this.bttnReplaceWeapon.Size = new System.Drawing.Size(88, 22);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
394 this.bttnReplaceWeapon.TabIndex = 10;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
395 this.bttnReplaceWeapon.Text = "replace";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
396 this.bttnReplaceWeapon.Click += new System.EventHandler(this.bttnReplaceWeapon_Click);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
397 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
398 // bttnEditWeapon
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
399 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
400 this.bttnEditWeapon.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
401 this.bttnEditWeapon.Enabled = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
402 this.bttnEditWeapon.FlatStyle = System.Windows.Forms.FlatStyle.System;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
403 this.bttnEditWeapon.Location = new System.Drawing.Point(516, 154);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
404 this.bttnEditWeapon.Name = "bttnEditWeapon";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
405 this.bttnEditWeapon.Size = new System.Drawing.Size(88, 22);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
406 this.bttnEditWeapon.TabIndex = 11;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
407 this.bttnEditWeapon.Text = "edit";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
408 this.bttnEditWeapon.Click += new System.EventHandler(this.bttnEditWeapon_Click);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
409 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
410 // lblPoints
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
411 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
412 this.lblPoints.Location = new System.Drawing.Point(358, 8);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
413 this.lblPoints.Name = "lblPoints";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
414 this.lblPoints.Size = new System.Drawing.Size(77, 21);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
415 this.lblPoints.TabIndex = 12;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
416 this.lblPoints.Text = "(points)";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
417 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
418 // lblNotes
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
419 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
420 this.lblNotes.Location = new System.Drawing.Point(13, 317);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
421 this.lblNotes.Name = "lblNotes";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
422 this.lblNotes.Size = new System.Drawing.Size(84, 62);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
423 this.lblNotes.TabIndex = 13;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
424 this.lblNotes.Text = "notes";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
425 this.lblNotes.TextAlign = System.Drawing.ContentAlignment.TopRight;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
426 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
427 // notes
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
428 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
429 this.notes.Location = new System.Drawing.Point(102, 317);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
430 this.notes.Multiline = true;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
431 this.notes.Name = "notes";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
432 this.notes.ReadOnly = true;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
433 this.notes.Size = new System.Drawing.Size(408, 62);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
434 this.notes.TabIndex = 14;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
435 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
436 // abilitiesList
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
437 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
438 this.abilitiesList.FormattingEnabled = true;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
439 this.abilitiesList.Location = new System.Drawing.Point(102, 240);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
440 this.abilitiesList.Name = "abilitiesList";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
441 this.abilitiesList.Size = new System.Drawing.Size(408, 69);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
442 this.abilitiesList.TabIndex = 15;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
443 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
444 // lblAbilities
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
445 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
446 this.lblAbilities.Location = new System.Drawing.Point(13, 240);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
447 this.lblAbilities.Name = "lblAbilities";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
448 this.lblAbilities.Size = new System.Drawing.Size(84, 62);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
449 this.lblAbilities.TabIndex = 16;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
450 this.lblAbilities.Text = "abilities";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
451 this.lblAbilities.TextAlign = System.Drawing.ContentAlignment.TopRight;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
452 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
453 // statsPanel
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
454 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
455 this.statsPanel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
456 | System.Windows.Forms.AnchorStyles.Right)));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
457 this.statsPanel.AutoScroll = true;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
458 this.statsPanel.Location = new System.Drawing.Point(8, 35);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
459 this.statsPanel.Name = "statsPanel";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
460 this.statsPanel.Size = new System.Drawing.Size(600, 85);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
461 this.statsPanel.TabIndex = 17;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
462 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
463 // FrmUnit
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
464 //
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
465 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
466 this.ClientSize = new System.Drawing.Size(616, 391);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
467 this.Controls.Add(this.statsPanel);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
468 this.Controls.Add(this.lblAbilities);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
469 this.Controls.Add(this.abilitiesList);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
470 this.Controls.Add(this.notes);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
471 this.Controls.Add(this.lblNotes);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
472 this.Controls.Add(this.lblPoints);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
473 this.Controls.Add(this.bttnEditWeapon);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
474 this.Controls.Add(this.bttnReplaceWeapon);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
475 this.Controls.Add(this.equipmentList);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
476 this.Controls.Add(this.bttnRemoveWeapon);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
477 this.Controls.Add(this.bttnAddWeapon);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
478 this.Controls.Add(this.lblEquip);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
479 this.Controls.Add(this.lblUnitSize);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
480 this.Controls.Add(this.unitSize);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
481 this.Controls.Add(this.tbUnitName);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
482 this.Name = "FrmUnit";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
483 this.ShowIcon = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
484 this.ShowInTaskbar = false;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
485 this.Text = "FrmUnit";
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
486 this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.FrmUnit_FormClosing);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
487 ((System.ComponentModel.ISupportInitialize)(this.unitSize)).EndInit();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
488 this.ResumeLayout(false);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
489 this.PerformLayout();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
490
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
491 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
492 #endregion
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
493
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
494 public Unit Unit
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
495 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
496 get { return unit; }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
497 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
498
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
499 private void tbUnitName_Leave(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
500 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
501 UpdateUnitName();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
502 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
503
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
504 private void tbUnitName_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
505 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
506 if (e.KeyCode == Keys.Enter)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
507 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
508 UpdateUnitName();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
509 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
510 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
511
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
512 private void UpdateUnitName()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
513 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
514 if (unit.Name != tbUnitName.Text)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
515 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
516 commandStack.Execute(new SetNameCommand(unit, tbUnitName.Text));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
517 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
518 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
519
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
520 private void unitSize_Leave(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
521 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
522 UpdateUnitSize();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
523 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
524
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
525 private void unitSize_KeyDown(object sender, System.Windows.Forms.KeyEventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
526 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
527 if (e.KeyCode == Keys.Enter)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
528 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
529 UpdateUnitSize();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
530 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
531 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
532
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
533 private void UpdateUnitSize()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
534 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
535 if (unit.Size != unitSize.Value)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
536 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
537 commandStack.Execute(new SetUnitSizeCommand(unit, (int) unitSize.Value));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
538 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
539 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
540
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
541 private void unit_NameChanged(WarFoundryObject obj, string oldValue, string newValue)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
542 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
543 if (obj is Unit && obj.Equals(unit))
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
544 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
545 SetUnitName();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
546 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
547 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
548
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
549 private void unit_UnitSizeChanged(WarFoundryObject obj, int oldValue, int newValue)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
550 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
551 if (obj is Unit && obj.Equals(unit))
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
552 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
553 unitSize.Value = newValue;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
554 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
555 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
556
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
557 private void RefreshUnitEquipment()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
558 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
559 foreach (UnitEquipmentChoice choice in equipmentChoices.Values)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
560 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
561 SetEquipmentListValue(choice);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
562 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
563 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
564
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
565 private void equipmentList_SelectedIndexChanged(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
566 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
567 SetButtonsEnabledState();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
568 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
569
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
570 private void SetButtonsEnabledState()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
571 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
572
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
573 UnitEquipmentItem equipItem = GetSelectedUnitEquipmentItem();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
574 bttnReplaceWeapon.Enabled = (equipItem != null && equipItem.HasAlternatives());
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
575 bttnEditWeapon.Enabled = (equipItem != null);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
576 bttnRemoveWeapon.Enabled = (equipItem != null && !equipItem.IsRequired);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
577 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
578
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
579 private void unit_UnitEquipmentAmountChanged(WarFoundryObject obj, double oldValue, double newValue)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
580 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
581 if (obj is UnitEquipmentItem)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
582 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
583 UnitEquipmentItem equip = (UnitEquipmentItem) obj;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
584 UnitEquipmentChoice equipChoice = GetEquipmentChoice(equip);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
585
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
586 if (newValue == 0)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
587 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
588 equipmentList.Items.Remove(equipChoice);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
589 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
590 else
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
591 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
592 SetEquipmentListValue(equipChoice);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
593 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
594 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
595 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
596
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
597 private void SetEquipmentListValue(UnitEquipmentChoice equipChoice)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
598 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
599 int idx = equipmentList.Items.IndexOf(equipChoice);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
600
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
601 if (idx > -1)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
602 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
603 equipmentList.Items[idx] = equipChoice;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
604 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
605 else
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
606 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
607 equipmentList.Items.Add(equipChoice);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
608 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
609 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
610
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
611 private void EditWeapon()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
612 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
613 UnitEquipmentItem item = GetSelectedUnitEquipmentItem();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
614
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
615 if (item != null)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
616 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
617 FrmEditUnitEquipment editEquip = new FrmEditUnitEquipment(Unit, item, commandStack);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
618 editEquip.ShowDialog(this);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
619 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
620 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
621
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
622 private UnitEquipmentItem GetSelectedUnitEquipmentItem()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
623 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
624 UnitEquipmentChoice selectedItem = GetSelectedUnitEquipmentChoice();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
625 UnitEquipmentItem equipItem = null;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
626
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
627 if (selectedItem!=null)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
628 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
629 equipItem = selectedItem.Item;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
630 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
631
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
632 return equipItem;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
633 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
634
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
635 private UnitEquipmentChoice GetSelectedUnitEquipmentChoice()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
636 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
637 return (UnitEquipmentChoice) equipmentList.SelectedItem;
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
638 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
639
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
640 private void bttnEditWeapon_Click(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
641 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
642 EditWeapon();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
643 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
644
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
645 private void equipmentList_DoubleClick(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
646 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
647 EditWeapon();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
648 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
649
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
650 private void AddWeapon()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
651 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
652 FrmNewUnitEquipment newEquip = new FrmNewUnitEquipment(Unit, commandStack);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
653 newEquip.ShowDialog(this);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
654 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
655
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
656 private void bttnAddWeapon_Click(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
657 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
658 AddWeapon();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
659 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
660
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
661 private void RemoveWeapon()
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
662 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
663 commandStack.Execute(new SetUnitEquipmentNumericAmountCommand(unit, GetSelectedUnitEquipmentItem(), 0));
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
664 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
665
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
666 private void bttnRemoveWeapon_Click(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
667 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
668 RemoveWeapon();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
669 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
670
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
671 private void bttnReplaceWeapon_Click(object sender, System.EventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
672 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
673 FrmReplaceUnitEquipment replace = new FrmReplaceUnitEquipment(unit, GetSelectedUnitEquipmentItem(), commandStack);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
674 replace.ShowDialog(this);
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
675 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
676
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
677 private void FrmUnit_FormClosing(object sender, FormClosingEventArgs e)
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
678 {
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
679 UpdateUnitName();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
680 UpdateUnitSize();
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
681 }
eaa7b639d390 * Fix build issues
IBBoard <dev@ibboard.co.uk>
parents: 190
diff changeset
682 }
27
526fefefb16b Fixes #91: Fix WinForms rendering of unit stats
IBBoard <dev@ibboard.co.uk>
parents: 24
diff changeset
683 }