Ignore:
Timestamp:
02/23/21 16:36:44 (8 weeks ago)
Author:
dpiringe
Message:

#3026

  • removed property ConvertableType from all converters
  • removed the option to fixate or loosen the path of JsonItems (obsolete)
  • added a abstract formatter SymbolicRegressionSolutionFormatterBase as base formatter for ISymbolicRegressionSolution
  • unified the construction of exporter controls
  • code cleanup
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ValueLookupJsonItemControl.cs

    r17828 r17843  
    1212namespace HeuristicLab.JsonInterface.OptimizerIntegration {
    1313  public partial class ValueLookupJsonItemControl : UserControl {
    14     private static IDictionary<Type, Type> JI2VM { get; set; }
    1514
    16     public ValueLookupJsonItemControl(IValueLookupJsonItemVM vm) {
     15    private static IDictionary<Type, Type> ji2vm = null;
     16    private static IDictionary<Type, Type> JI2VM {
     17      get {
     18        if (ji2vm == null) {
     19          ji2vm = new Dictionary<Type, Type>();
     20          foreach (var vmType in ApplicationManager.Manager.GetTypes(typeof(IJsonItemVM))) {
     21            IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType);
     22            ji2vm.Add(vm.TargetedJsonItemType, vmType);
     23          }
     24        }
     25        return ji2vm;
     26      }
     27    }
     28
     29    private ValueLookupJsonItemControl() {
    1730      InitializeComponent();
    18       InitCache();
     31    }
     32
     33    protected ValueLookupJsonItemControl(IValueLookupJsonItemVM vm) {
     34      InitializeComponent();
    1935      if (vm.JsonItemReference != null && JI2VM.TryGetValue(vm.JsonItemReference.GetType(), out Type vmType)) {
    2036        IJsonItemVM tmp = (IJsonItemVM)Activator.CreateInstance(vmType);
     
    2945    }
    3046
    31     private void InitCache() {
    32       if(JI2VM == null) {
    33         JI2VM = new Dictionary<Type, Type>();
    34         foreach (var vmType in ApplicationManager.Manager.GetTypes(typeof(IJsonItemVM))) {
    35           IJsonItemVM vm = (IJsonItemVM)Activator.CreateInstance(vmType);
    36           JI2VM.Add(vm.TargetedJsonItemType, vmType);
    37         }
    38       }
    39     }
     47    public static ValueLookupJsonItemControl Create(IValueLookupJsonItemVM vm) => new ValueLookupJsonItemControl(vm);
    4048  }
    4149}
Note: See TracChangeset for help on using the changeset viewer.