diff UI/EquipmentAmountControl.cs @ 88:340e711ca4c3

Re #205: Odd/prime numbers causes a crash * Resolve crash in call stack by ignoring update events when updating a spinner box
author IBBoard <dev@ibboard.co.uk>
date Mon, 02 Nov 2009 20:02:12 +0000
parents 0bb9f40d44eb
children 971f7801f984
line wrap: on
line diff
--- a/UI/EquipmentAmountControl.cs	Sat Oct 31 21:09:10 2009 +0000
+++ b/UI/EquipmentAmountControl.cs	Mon Nov 02 20:02:12 2009 +0000
@@ -125,8 +125,10 @@
 		}
 
 		private void SetNumericValueFromPercentage()
-		{
-			numeric.Value = CalculateNumericValueFromPercentage(percentage.Value);
+		{
+			numeric.ValueChanged -= numeric_ValueChanged;
+			numeric.Value = CalculateNumericValueFromPercentage(percentage.Value);
+			numeric.ValueChanged += numeric_ValueChanged;
 		}
 
 		private decimal CalculateNumericValueFromPercentage(decimal percent)
@@ -142,8 +144,10 @@
 
 		private void SetPercentageValueFromNumeric()
 		{
-			int number = (int)numeric.Value;
-			percentage.Value = CalcualtePercentageValueFromNumber(number);
+			int number = (int)numeric.Value;
+			percentage.ValueChanged -= percentage_ValueChanged;
+			percentage.Value = CalcualtePercentageValueFromNumber(number);
+			percentage.ValueChanged += percentage_ValueChanged;
 		}
 
 		private decimal CalcualtePercentageValueFromNumber(int number)