Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.CEDMA.Core/3.3/ConsoleEditor.cs @ 2289

Last change on this file since 2289 was 2289, checked in by mkommend, 15 years ago
  • added VisualMatrix to represent data in BubbleChart
  • made BubbleChart abstract and added inherited ModelingBubbleChart, which reacts as the BubbleChart
  • moved classes between CEDMA.Core and CEDMA.Charting
  • deleted unnecessary classes (results, resultsentry)

(ticket #723)

File size: 4.3 KB
Line 
1#region License Information
2/* HeuristicLab
3 * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
4 *
5 * This file is part of HeuristicLab.
6 *
7 * HeuristicLab is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
12 * HeuristicLab is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
19 */
20#endregion
21
22using System;
23using System.Collections.Generic;
24using System.Linq;
25using System.Text;
26using HeuristicLab.Core;
27using System.Windows.Forms;
28using System.ServiceModel;
29using HeuristicLab.PluginInfrastructure;
30using System.Drawing;
31using HeuristicLab.CEDMA.Charting;
32
33namespace HeuristicLab.CEDMA.Core {
34  class ConsoleEditor : EditorBase {
35    private ComboBox viewComboBox;
36    private Button resultsButton;
37    private Button openButton;
38    private Console console;
39    private VisualMatrix matrix;
40
41    public ConsoleEditor(Console console) {
42      InitializeComponent();
43      this.console = console;
44      resultsButton.Enabled = false;
45      viewComboBox.Enabled = false;
46      PopulateViewComboBox();
47    }
48
49    #region autogenerated code
50    private void InitializeComponent() {
51      this.viewComboBox = new System.Windows.Forms.ComboBox();
52      this.resultsButton = new System.Windows.Forms.Button();
53      this.openButton = new System.Windows.Forms.Button();
54      this.SuspendLayout();
55      //
56      // viewComboBox
57      //
58      this.viewComboBox.FormattingEnabled = true;
59      this.viewComboBox.Location = new System.Drawing.Point(0, 29);
60      this.viewComboBox.Name = "viewComboBox";
61      this.viewComboBox.Size = new System.Drawing.Size(121, 21);
62      this.viewComboBox.TabIndex = 7;
63      //
64      // resultsButton
65      //
66      this.resultsButton.Location = new System.Drawing.Point(127, 27);
67      this.resultsButton.Name = "resultsButton";
68      this.resultsButton.Size = new System.Drawing.Size(86, 23);
69      this.resultsButton.TabIndex = 6;
70      this.resultsButton.Text = "Show results";
71      this.resultsButton.UseVisualStyleBackColor = true;
72      this.resultsButton.Click += new System.EventHandler(this.resultsButton_Click);
73      //
74      // openButton
75      //
76      this.openButton.Location = new System.Drawing.Point(4, 0);
77      this.openButton.Name = "openButton";
78      this.openButton.Size = new System.Drawing.Size(75, 23);
79      this.openButton.TabIndex = 8;
80      this.openButton.Text = "Open...";
81      this.openButton.UseVisualStyleBackColor = true;
82      this.openButton.Click += new System.EventHandler(this.openButton_Click);
83      //
84      // ConsoleEditor
85      //
86      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
87      this.Controls.Add(this.openButton);
88      this.Controls.Add(this.viewComboBox);
89      this.Controls.Add(this.resultsButton);
90      this.Name = "ConsoleEditor";
91      this.Size = new System.Drawing.Size(224, 112);
92      this.ResumeLayout(false);
93
94    }
95
96    #endregion
97
98    private void PopulateViewComboBox() {
99      DiscoveryService service = new DiscoveryService();
100      IResultsViewFactory[] factories = service.GetInstances<IResultsViewFactory>();
101      viewComboBox.DataSource = factories;
102      viewComboBox.ValueMember = "Name";
103    }
104
105    private void resultsButton_Click(object sender, EventArgs e) {
106      IResultsViewFactory factory = (IResultsViewFactory)viewComboBox.SelectedItem;
107      IControl control = factory.CreateView(console.VisualMatrix);
108      PluginManager.ControlManager.ShowControl(control);
109    }
110
111    private void openButton_Click(object sender, EventArgs e) {
112      OpenFileDialog dialog = new OpenFileDialog();
113      DialogResult result = dialog.ShowDialog();
114      if (result == DialogResult.OK) {
115        viewComboBox.Enabled = true;
116        resultsButton.Enabled = true;
117        console.Database = dialog.FileName;
118      }
119    }
120  }
121}
Note: See TracBrowser for help on using the repository browser.