source: branches/CEDMA-Refactoring-Ticket419/HeuristicLab.CEDMA.Core/TableResultsView.cs @ 1108

Last change on this file since 1108 was 1108, checked in by gkronber, 12 years ago

worked on CEDMA presentation layer (bubble chart, and collection of results) (#419)

File size: 1.4 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9using HeuristicLab.Core;
10using HeuristicLab.CEDMA.Core;
11
12namespace 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    string IResultsView.Name {
24      get { return "Table"; }
25    }
26
27    public void ShowResults(Results results) {
28      this.results = results;
29      UpdateControls();
30    }
31
32    protected override void UpdateControls() {
33      base.UpdateControls();
34      if (results == null) return;
35      dataGridView.Rows.Clear();
36      dataGridView.Columns.Clear();
37      List<string> attributeNames = results.SelectModelAttributes().ToList();
38      foreach (var attribute in attributeNames) {
39        dataGridView.Columns.Add(attribute, attribute);
40      }
41
42      var entries = results.SelectRows();
43      foreach (var entry in entries) {
44        int rowIndex = dataGridView.Rows.Add();
45        foreach (string attrName in attributeNames) {
46          dataGridView.Rows[rowIndex].Cells[attrName].Value = entry.Get(attrName);
47        }
48        dataGridView.Rows.Add(row);
49      }
50      dataGridView.Update();
51    }
52  }
53}
Note: See TracBrowser for help on using the repository browser.