Exemplo n.º 1
0
 public string ToString(ValueFormat format)
 {
     if (format == ValueFormat.Scientific)
     {
         if (Power >= 3)
         {
             return($"{Gain}*10^{Power}");
         }
         else
         {
             return($"{Gain}");
         }
     }
     if (format == ValueFormat.Literal)
     {
         var powerName = PowerNamer.GetName(Power);
         if (string.IsNullOrEmpty(powerName))
         {
             return($"{Gain}");
         }
         else
         {
             return($"{Gain} {powerName}");
         }
     }
     else
     {
         //Impossible to reach, convert to switch ??
         return("");
     }
 }
Exemplo n.º 2
0
        private void UpdateUI(object sender, Value e)
        {
            TextView tw1 = FindViewById <TextView>(Resource.Id.textview1);
            TextView tw2 = FindViewById <TextView>(Resource.Id.textview2);

            RunOnUiThread(() => {
                if (tw1 != null)
                {
                    tw1.Text = _engine.CurrentValue.Gain.ToString();
                }
                if (tw2 != null)
                {
                    tw2.Text = PowerNamer.GetName(_engine.CurrentValue.Power);
                }
            });
        }
Exemplo n.º 3
0
 public override string ToString()
 {
     if (Settings.ScientificNotation)
     {
         return($"{Gain}*10^{Power}");
     }
     else
     {
         var powerName = PowerNamer.GetName(Power);
         if (string.IsNullOrEmpty(powerName))
         {
             return($"{Gain}");
         }
         else
         {
             return($"{Gain} {powerName}");
         }
     }
 }
Exemplo n.º 4
0
        public void CorrectNameReturned(int power, string name)
        {
            var powerName = PowerNamer.GetName(power);

            Assert.AreEqual(name, powerName);
        }