/[OhmsLawCalc]/trunk/OhmsLawCalc/UI/CircuitValue.cs
ViewVC logotype

Diff of /trunk/OhmsLawCalc/UI/CircuitValue.cs

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

--- trunk/OhmsLawCalc/UI/CircuitValue.cs	2015/03/14 17:21:12	53
+++ trunk/OhmsLawCalc/UI/CircuitValue.cs	2015/03/14 17:23:49	54
@@ -37,7 +37,7 @@
         private void CircuitValue_Load(object sender, EventArgs e)
         {
             Reset();
-            //bLoadDone = true;
+            bLoadDone = true;
         }
 
         private string CreateUnitString(OhmsLawUnitType unit)
@@ -113,7 +113,7 @@
             comboUnits.Items.Add(CreateUnitString(OhmsLawUnitType.Giga));
 
             comboUnits.Text = comboUnits.Items[DefaultValueIndex].ToString();
-            //bFirstConversion = true;
+            bFirstConversion = true;
         }
         #endregion
 
@@ -148,29 +148,29 @@
         }
         #endregion
 
-        //bool bFirstConversion = true;
-        //bool bLoadDone = false;
+        bool bFirstConversion = true;
+        bool bLoadDone = false;
         private void comboUnits_SelectedIndexChanged(object sender, EventArgs e)
         {
 
-            //if(!bLoadDone){return;}
-            //if (bFirstConversion)
-            //{               
-            //    var result = new OhmsLawValue(this.ValueType, OhmsLawUnitType.Default, fBox.ToSingle());
-            //    result = OhmsLaw.ConvertResult(result, GetUnitType());
-            //    SetValue(result);
-            //    bFirstConversion = false;
-            //    LastUnitType = GetUnitType();
-            //}
-            //else
-            //{
-            //    var unit = GetUnitType();
-            //    var result = new OhmsLawValue(this.ValueType, LastUnitType, fBox.ToSingle());
-            //    result = OhmsLaw.ConvertResult(result,  OhmsLawUnitType.Default);
-            //    result = OhmsLaw.ConvertResult(result, GetUnitType());
-            //    SetValue(result);
-            //    LastUnitType = GetUnitType();
-            //}
+            if (!bLoadDone) { return; }
+            if (bFirstConversion)
+            {
+                var result = new OhmsLawValue(this.ValueType, OhmsLawUnitType.Default, fBox.ToSingle());
+                result = OhmsLaw.ConvertResult(result, GetUnitType());
+                SetValue(result);
+                bFirstConversion = false;
+                LastUnitType = GetUnitType();
+            }
+            else
+            {
+                var unit = GetUnitType();
+                var result = new OhmsLawValue(this.ValueType, LastUnitType, fBox.ToSingle());
+                result = OhmsLaw.ConvertResult(result, OhmsLawUnitType.Default);
+                result = OhmsLaw.ConvertResult(result, GetUnitType());
+                SetValue(result);
+                LastUnitType = GetUnitType();
+            }
            // var unit = GetUnitType();
            // var result = GetValue();
            // result = OhmsLaw.ConvertResult(result, unit);

 

  ViewVC Help
Powered by ViewVC 1.1.22