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(""); } }
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); } }); }
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}"); } } }
public void CorrectNameReturned(int power, string name) { var powerName = PowerNamer.GetName(power); Assert.AreEqual(name, powerName); }