Last change
on this file since 17842 was
17834,
checked in by dpiringe, 4 years 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 | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Data;
|
---|
5 | using System.Drawing;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Threading.Tasks;
|
---|
9 | using System.Windows.Forms;
|
---|
10 |
|
---|
11 | namespace 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.