changeset 53:e6d0d9eababf

Fixes #163: Show unit cost on unit dialog * Add a quick label with the points cost of the unit - can be moved and repositioned based on user feedback
author IBBoard <dev@ibboard.co.uk>
date Wed, 16 Sep 2009 19:50:39 +0000
parents 4a56900936aa
children d6ff354a5d84
files FrmUnit.cs
diffstat 1 files changed, 22 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/FrmUnit.cs	Wed Sep 16 19:41:27 2009 +0000
+++ b/FrmUnit.cs	Wed Sep 16 19:50:39 2009 +0000
@@ -40,6 +40,7 @@
 		private System.Windows.Forms.Label lblOptionalEquip;
 		private System.Windows.Forms.Button bttnReplaceWeapon;
 		private System.Windows.Forms.Button bttnEditReqdWeapon;
+		private Label lblPoints;
 		/// <summary>
 		/// Required designer variable.
 		/// </summary>
@@ -59,6 +60,7 @@
 			unit.NameChanged += new StringValChangedDelegate(unit_NameChanged);
 			unit.UnitSizeChanged += new IntValChangedDelegate(unit_UnitSizeChanged);
 			unit.UnitEquipmentAmountChanged += new DoubleValChangedDelegate(unit_UnitEquipmentAmountChanged);
+			unit.PointsValueChanged += new DoubleValChangedDelegate(unit_PointsValueChanged);
 
 			if (unit.UnitType.MaxSize == unit.UnitType.MinSize)
 			{
@@ -73,10 +75,21 @@
 				unitSize.Minimum = unit.UnitType.MinSize;
 			}
 
+			SetPointsValueText();
 			SetStats();
 			SetWeapons();
 		}
 
+		void unit_PointsValueChanged(WarFoundryObject obj, double oldValue, double newValue)
+		{
+			SetPointsValueText();
+		}
+
+		private void SetPointsValueText()
+		{
+			lblPoints.Text = "(" + unit.PointsValue + " pts)";
+		}
+
 		private void SetStats()
 		{
 			DataTable dt = new DataTable();
@@ -188,6 +201,7 @@
 			this.lblOptionalEquip = new System.Windows.Forms.Label();
 			this.bttnReplaceWeapon = new System.Windows.Forms.Button();
 			this.bttnEditReqdWeapon = new System.Windows.Forms.Button();
+			this.lblPoints = new System.Windows.Forms.Label();
 			((System.ComponentModel.ISupportInitialize)(this.statsGrid)).BeginInit();
 			((System.ComponentModel.ISupportInitialize)(this.unitSize)).BeginInit();
 			this.SuspendLayout();
@@ -350,10 +364,18 @@
 			this.bttnEditReqdWeapon.Text = "edit";
 			this.bttnEditReqdWeapon.Click += new System.EventHandler(this.bttnEditReqdWeapon_Click);
 			// 
+			// lblPoints
+			// 
+			this.lblPoints.Location = new System.Drawing.Point(358, 8);
+			this.lblPoints.Name = "lblPoints";
+			this.lblPoints.Size = new System.Drawing.Size(100, 21);
+			this.lblPoints.TabIndex = 12;
+			// 
 			// FrmUnit
 			// 
 			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
 			this.ClientSize = new System.Drawing.Size(616, 314);
+			this.Controls.Add(this.lblPoints);
 			this.Controls.Add(this.bttnEditReqdWeapon);
 			this.Controls.Add(this.bttnReplaceWeapon);
 			this.Controls.Add(this.optList);