Last change
on this file since 1106 was
1106,
checked in by gkronber, 15 years ago
|
worked on presentation layer for CEDMA. Added a results view that displays data in a simple DataGrid. (#419)
|
File size:
1.2 KB
|
Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.ComponentModel;
|
---|
4 | using System.Drawing;
|
---|
5 | using System.Data;
|
---|
6 | using System.Linq;
|
---|
7 | using System.Text;
|
---|
8 | using System.Windows.Forms;
|
---|
9 | using HeuristicLab.Core;
|
---|
10 | using HeuristicLab.CEDMA.Core;
|
---|
11 |
|
---|
12 | namespace HeuristicLab.CEDMA.Core {
|
---|
13 | public partial class TableResultsView : ViewBase, IResultsView {
|
---|
14 | private Results results;
|
---|
15 | public TableResultsView() {
|
---|
16 | InitializeComponent();
|
---|
17 | }
|
---|
18 |
|
---|
19 | public Control Control {
|
---|
20 | get { return this; }
|
---|
21 | }
|
---|
22 |
|
---|
23 | public void ShowResults(Results results) {
|
---|
24 | this.results = results;
|
---|
25 | UpdateControls();
|
---|
26 | }
|
---|
27 |
|
---|
28 | protected override void UpdateControls() {
|
---|
29 | base.UpdateControls();
|
---|
30 | if (results == null) return;
|
---|
31 | List<string> columnNames = new List<string>();
|
---|
32 | columnNames.AddRange(Results.CategoricalVariables);
|
---|
33 | columnNames.AddRange(Results.OrdinalVariables);
|
---|
34 | dataGridView.Rows.Clear();
|
---|
35 | dataGridView.Columns.Clear();
|
---|
36 | foreach (string varName in columnNames) {
|
---|
37 | dataGridView.Columns.Add(varName, varName);
|
---|
38 | }
|
---|
39 |
|
---|
40 | foreach (object[] row in results.SelectRows(columnNames)) {
|
---|
41 | dataGridView.Rows.Add(row);
|
---|
42 | }
|
---|
43 | dataGridView.Update();
|
---|
44 | }
|
---|
45 | }
|
---|
46 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.