Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
02/10/20 16:46:09 (5 years ago)
Author:
dpiringe
Message:

#3026:

  • renamed JsonItemArrayValueControl to JsonItemMultiValueControl
  • extracted converter logic from property Value in JsonItem<V,R> into new private method ConvertObject
  • added references to TreeNode and TreeView in JsonItemVMBase -> for additional user feedback when enabling/disabling an item (changes the fore color of referenced node)
  • changed implementation and interplay between ArrayValueVM and JsonItemMultiValueControl -> removed the direct access of property DataSource of DataGridView -> now: dynamically adds new columns/rows and accesses grid cells manually (better handling with matrices)
  • added new VM MatrixValueVM
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface/Models/GenericJsonItem.cs

    r17417 r17431  
    1313  public class JsonItem<V,R> : JsonItem {
    1414    public new V Value {
    15       get {
    16         if(base.Value is IConvertible)
    17           return (V)Convert.ChangeType(base.Value, typeof(V));
    18 
    19         if(base.Value is JToken token)
    20           return token.ToObject<V>();
    21 
    22         return (V)base.Value;
    23       }
     15      get => ConvertObject(base.Value);
    2416      set => base.Value = value;
    2517    }
    26 
     18   
    2719    public new IEnumerable<R> Range {
    2820      get => base.Range?.Cast<R>();
    2921      set => base.Range = value.Cast<object>();
    3022    }
     23
     24    private V ConvertObject(object obj) {
     25      if (obj is IConvertible)
     26        return (V)Convert.ChangeType(obj, typeof(V));
     27
     28      if (obj is JToken token)
     29        return token.ToObject<V>();
     30
     31      return (V)obj;
     32    }
    3133  }
    3234}
Note: See TracChangeset for help on using the changeset viewer.