Free cookie consent management tool by TermsFeed Policy Generator

Changeset 3402 for trunk


Ignore:
Timestamp:
04/18/10 22:16:08 (15 years ago)
Author:
swagner
Message:

Implemented reviewers' comments (#893)

Location:
trunk/sources
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Data.Views/3.3/StringConvertibleValueView.cs

    r3362 r3402  
    105105      Content.SetValue(valueTextBox.Text);
    106106      errorProvider.SetError(valueTextBox, string.Empty);
     107      valueTextBox.Text = Content.GetValue();
    107108    }
    108109  }
  • trunk/sources/HeuristicLab.Data/3.3/PercentValue.cs

    r3376 r3402  
    4040
    4141    public override string ToString() {
    42       return (Value * 100).ToString("r") + " %";  // round-trip format
     42      return Value.ToString("#0.#################### %");  // percent format
    4343    }
    4444
    4545    protected override bool Validate(string value, out string errorMessage) {
    46       value = value.Replace("%", string.Empty);
     46      value = value.Replace("%", " ");
    4747      return base.Validate(value, out errorMessage);
    4848    }
    4949    protected override string GetValue() {
    50       return (Value * 100).ToString("r") + " %";  // round-trip format
     50      return Value.ToString("#0.#################### %");  // percent format
    5151    }
    5252    protected override bool SetValue(string value) {
    53       value = value.Replace("%", string.Empty);
     53      bool percent = value.Contains("%");
     54      value = value.Replace("%", " ");
    5455      double val;
    5556      if (double.TryParse(value, out val)) {
    56         Value = val == 0 ? 0 : val / 100;
     57        if (percent) {
     58          if (!(val).IsAlmost(Value * 100.0))
     59            Value = val == 0 ? 0 : val / 100.0;
     60        } else {
     61          Value = val;
     62        }
    5763        return true;
    5864      } else {
Note: See TracChangeset for help on using the changeset viewer.