annotate FrmNewUnitEquipment.cs @ 24:7c366fe55635

* Fix line terminators no-open-ticket
author IBBoard <dev@ibboard.co.uk>
date Sat, 27 Jun 2009 19:01:59 +0000
parents 19bdbb80999c
children 3ceb0efd261f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
1 // This file (FrmNewUnitEquipment.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: 10
diff changeset
2 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
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: 10
diff changeset
4
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
5 using System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
6 using System.Drawing;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
7 using System.Collections;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
8 using System.ComponentModel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
9 using System.Windows.Forms;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
10 using IBBoard;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
11 using IBBoard.Commands;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
12 using IBBoard.WarFoundry.API;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
13 using IBBoard.WarFoundry.API.Commands;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
14 using IBBoard.WarFoundry.API.Objects;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
15
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
16 namespace IBBoard.WarFoundry
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
17 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
18 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
19 /// Summary description for FrmNewUnitEquipment.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
20 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
21 public class FrmNewUnitEquipment : System.Windows.Forms.Form
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
22 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
23 private Unit unit;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
24 private bool required;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
25 private CommandStack commandStack;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
26
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
27 private System.Windows.Forms.NumericUpDown numEquipAmount;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
28 private System.Windows.Forms.Label lblPercent;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
29 private System.Windows.Forms.Label lblAmount;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
30 private System.Windows.Forms.Button bttnCancel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
31 private System.Windows.Forms.Button bttnOkay;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
32 private System.Windows.Forms.CheckBox cbEquipAll;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
33 private System.Windows.Forms.Label lblItem;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
34 private System.Windows.Forms.ListBox listItems;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
35 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
36 /// Required designer variable.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
37 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
38 private System.ComponentModel.Container components = null;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
39
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
40 public FrmNewUnitEquipment(Unit unit, CommandStack stack)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
41 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
42 commandStack = stack;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
43 this.unit = unit;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
44 InitializeComponent();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
45 this.Text = "New equipment for " + unit.Name;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
46 object[] items = Arrays.Subtract(unit.GetAllowedOptionalEquipment(), unit.GetEquipment());
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
47 listItems.Items.AddRange(items);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
48 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
49
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
50 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
51 /// Clean up any resources being used.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
52 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
53 protected override void Dispose( bool disposing )
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
54 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
55 if( disposing )
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
56 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
57 if(components != null)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
58 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
59 components.Dispose();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
60 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
61 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
62 base.Dispose( disposing );
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
63 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
64
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
65 #region Windows Form Designer generated code
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
66 /// <summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
67 /// Required method for Designer support - do not modify
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
68 /// the contents of this method with the code editor.
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
69 /// </summary>
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
70 private void InitializeComponent()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
71 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
72 this.numEquipAmount = new System.Windows.Forms.NumericUpDown();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
73 this.lblPercent = new System.Windows.Forms.Label();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
74 this.lblAmount = new System.Windows.Forms.Label();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
75 this.bttnCancel = new System.Windows.Forms.Button();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
76 this.bttnOkay = new System.Windows.Forms.Button();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
77 this.cbEquipAll = new System.Windows.Forms.CheckBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
78 this.lblItem = new System.Windows.Forms.Label();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
79 this.listItems = new System.Windows.Forms.ListBox();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
80 ((System.ComponentModel.ISupportInitialize)(this.numEquipAmount)).BeginInit();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
81 this.SuspendLayout();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
82 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
83 // numEquipAmount
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
84 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
85 this.numEquipAmount.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
86 this.numEquipAmount.Location = new System.Drawing.Point(88, 80);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
87 this.numEquipAmount.Name = "numEquipAmount";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
88 this.numEquipAmount.Size = new System.Drawing.Size(144, 20);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
89 this.numEquipAmount.TabIndex = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
90 this.numEquipAmount.ValueChanged += new System.EventHandler(this.numEquipAmount_ValueChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
91 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
92 // lblPercent
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
93 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
94 this.lblPercent.Location = new System.Drawing.Point(208, 80);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
95 this.lblPercent.Name = "lblPercent";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
96 this.lblPercent.Size = new System.Drawing.Size(16, 16);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
97 this.lblPercent.TabIndex = 1;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
98 this.lblPercent.Text = "%";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
99 this.lblPercent.Visible = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
100 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
101 // lblAmount
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
102 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
103 this.lblAmount.Location = new System.Drawing.Point(8, 80);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
104 this.lblAmount.Name = "lblAmount";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
105 this.lblAmount.Size = new System.Drawing.Size(72, 23);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
106 this.lblAmount.TabIndex = 2;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
107 this.lblAmount.Text = "amount";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
108 this.lblAmount.TextAlign = System.Drawing.ContentAlignment.TopRight;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
109 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
110 // bttnCancel
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
111 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
112 this.bttnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
113 this.bttnCancel.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
114 this.bttnCancel.Location = new System.Drawing.Point(160, 136);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
115 this.bttnCancel.Name = "bttnCancel";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
116 this.bttnCancel.TabIndex = 3;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
117 this.bttnCancel.Text = "cancel";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
118 this.bttnCancel.Click += new System.EventHandler(this.bttnCancel_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
119 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
120 // bttnOkay
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
121 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
122 this.bttnOkay.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
123 this.bttnOkay.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
124 this.bttnOkay.Location = new System.Drawing.Point(8, 136);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
125 this.bttnOkay.Name = "bttnOkay";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
126 this.bttnOkay.TabIndex = 4;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
127 this.bttnOkay.Text = "okay";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
128 this.bttnOkay.Click += new System.EventHandler(this.bttnOkay_Click);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
129 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
130 // cbEquipAll
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
131 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
132 this.cbEquipAll.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
133 this.cbEquipAll.FlatStyle = System.Windows.Forms.FlatStyle.System;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
134 this.cbEquipAll.Location = new System.Drawing.Point(88, 104);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
135 this.cbEquipAll.Name = "cbEquipAll";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
136 this.cbEquipAll.TabIndex = 5;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
137 this.cbEquipAll.Text = "equip all";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
138 this.cbEquipAll.CheckedChanged += new System.EventHandler(this.cbEquipAll_CheckedChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
139 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
140 // lblItem
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
141 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
142 this.lblItem.Location = new System.Drawing.Point(0, 8);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
143 this.lblItem.Name = "lblItem";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
144 this.lblItem.Size = new System.Drawing.Size(80, 23);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
145 this.lblItem.TabIndex = 6;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
146 this.lblItem.Text = "item";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
147 this.lblItem.TextAlign = System.Drawing.ContentAlignment.TopRight;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
148 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
149 // listItems
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
150 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
151 this.listItems.Location = new System.Drawing.Point(88, 8);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
152 this.listItems.Name = "listItems";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
153 this.listItems.Size = new System.Drawing.Size(144, 69);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
154 this.listItems.TabIndex = 7;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
155 this.listItems.SelectedIndexChanged += new System.EventHandler(this.listItems_SelectedIndexChanged);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
156 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
157 // FrmNewUnitEquipment
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
158 //
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
159 this.AcceptButton = this.bttnOkay;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
160 this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
161 this.CancelButton = this.bttnCancel;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
162 this.ClientSize = new System.Drawing.Size(240, 164);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
163 this.ControlBox = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
164 this.Controls.Add(this.listItems);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
165 this.Controls.Add(this.lblItem);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
166 this.Controls.Add(this.cbEquipAll);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
167 this.Controls.Add(this.bttnOkay);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
168 this.Controls.Add(this.bttnCancel);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
169 this.Controls.Add(this.lblAmount);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
170 this.Controls.Add(this.numEquipAmount);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
171 this.Controls.Add(this.lblPercent);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
172 this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
173 this.Name = "FrmNewUnitEquipment";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
174 this.ShowInTaskbar = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
175 this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
176 this.Text = "FrmEditUnitEquipment";
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
177 ((System.ComponentModel.ISupportInitialize)(this.numEquipAmount)).EndInit();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
178 this.ResumeLayout(false);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
179
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
180 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
181 #endregion
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
182
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
183 private void bttnOkay_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
184 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
185 setValue();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
186 this.Close();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
187 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
188
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
189 private void setValue()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
190 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
191 UnitEquipmentItem equipItem = (UnitEquipmentItem)listItems.SelectedItem;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
192
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
193 if (cbEquipAll.Checked)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
194 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
195 commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, WarFoundryCore.INFINITY));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
196 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
197 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
198 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
199 if (equipItem.IsRatioLimit)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
200 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
201 commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value / 100.0));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
202 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
203 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
204 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
205 commandStack.Execute(new SetUnitEquipmentAmountCommand(unit, equipItem, (double)numEquipAmount.Value));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
206 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
207 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
208 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
209
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
210 private void bttnCancel_Click(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
211 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
212 this.Close();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
213 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
214
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
215 private void cbEquipAll_CheckedChanged(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
216 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
217 numEquipAmount.Enabled = ((UnitEquipmentItem)listItems.SelectedItem).MinNumber != WarFoundryCore.INFINITY && !cbEquipAll.Checked;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
218 setOkayButton();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
219 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
220
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
221 private void listItems_SelectedIndexChanged(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
222 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
223 refreshNumber();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
224 setOkayButton();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
225 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
226
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
227 private void refreshNumber()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
228 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
229 if (listItems.SelectedIndex > -1)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
230 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
231 UnitEquipmentItem equipItem = (UnitEquipmentItem)listItems.SelectedItem;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
232 required = equipItem.IsRequired;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
233
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
234 if (equipItem.IsRatioLimit)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
235 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
236 numEquipAmount.Minimum = (decimal)Math.Round(equipItem.MinNumber * 100.0, 2);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
237 numEquipAmount.Maximum = (decimal)Math.Round(equipItem.MaxNumber * 100.0, 2);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
238 numEquipAmount.Value = numEquipAmount.Minimum;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
239 cbEquipAll.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
240 lblPercent.Visible = true;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
241 numEquipAmount.Width = 120;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
242 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
243 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
244 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
245 numEquipAmount.Minimum = (decimal)(equipItem.MinNumber != WarFoundryCore.INFINITY ? equipItem.MinNumber : unit.Size);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
246 numEquipAmount.Maximum = (decimal)(equipItem.MaxNumber != WarFoundryCore.INFINITY ? equipItem.MaxNumber : unit.Size);
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
247 numEquipAmount.Value = numEquipAmount.Minimum;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
248 cbEquipAll.Enabled = equipItem.MinNumber != WarFoundryCore.INFINITY;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
249 cbEquipAll.Checked = equipItem.MinNumber == WarFoundryCore.INFINITY;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
250 numEquipAmount.Width = 144;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
251 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
252 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
253 else
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
254 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
255 numEquipAmount.Minimum = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
256 numEquipAmount.Value = 0;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
257 numEquipAmount.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
258 cbEquipAll.Enabled = false;
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
259 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
260 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
261
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
262 private void setOkayButton()
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
263 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
264 bttnOkay.Enabled = listItems.SelectedIndex > -1 && (cbEquipAll.Checked || (numEquipAmount.Enabled && numEquipAmount.Value > 0));
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
265 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
266
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
267 private void numEquipAmount_ValueChanged(object sender, System.EventArgs e)
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
268 {
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
269 setOkayButton();
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
270 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
271 }
7c366fe55635 * Fix line terminators
IBBoard <dev@ibboard.co.uk>
parents: 10
diff changeset
272 }