source: branches/3026_IntegrationIntoSymSpace/HeuristicLab.JsonInterface.OptimizerIntegration/Views/ResultJsonItemControl.cs @ 17834

Last change on this file since 17834 was 17834, checked in by dpiringe, 2 months ago

#3026

  • added ResultFormatter to add an extra layer of result transformation logic (converting a result value to a string with a defined logic, e.g. MatlabResultFormatter for ISymbolicRegressionSolution)
  • extended the IResultJsonItem with two properties for result formatting
  • added a new control to selected a result formatter for a result value
  • refactored the Runner for the new result formatting process
File size: 1.1 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Data;
5using System.Drawing;
6using System.Linq;
7using System.Text;
8using System.Threading.Tasks;
9using System.Windows.Forms;
10
11namespace HeuristicLab.JsonInterface.OptimizerIntegration {
12  public partial class ResultJsonItemControl : UserControl {
13    public ResultJsonItemControl() {
14      InitializeComponent();
15    }
16
17    public static ResultJsonItemControl Create(ResultItemVM vm) {
18      var control = new ResultJsonItemControl();
19      var formatters = ResultFormatter.ForType(vm.Item.ValueType).ToList();
20      control.comboBoxFormatter.DataSource = formatters;
21      control.comboBoxFormatter.DisplayMember = "Name";
22     
23      // set action to override the ResultFormatterType property for changing the selected value
24      control.comboBoxFormatter.SelectedValueChanged += (s, e) => vm.ResultFormatterType = control.comboBoxFormatter.SelectedValue.GetType().FullName;
25      control.comboBoxFormatter.SelectedItem = formatters.Last();
26
27      return control;
28    }
29  }
30}
Note: See TracBrowser for help on using the repository browser.