changeset 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 4c5c8f91937a
children 971f7801f984
files UI/EquipmentAmountControl.cs
diffstat 1 files changed, 8 insertions(+), 4 deletions(-) [+]
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)