Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 2229 was 2223, checked in by mkommend, 15 years ago

reintegrated branch new heuristic.modeling database backend (ticket #712)

File size: 3.6 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;
31
32namespace HeuristicLab.CEDMA.Core {
33  class ConsoleEditor : EditorBase {
34    private ComboBox viewComboBox;
35    private Button resultsButton;
36    private Console console;
37
38    public ConsoleEditor(Console console) {
39      InitializeComponent();
40      this.console = console;
41      PopulateViewComboBox();
42    }
43
44    #region autogenerated code
45    private void InitializeComponent() {
46      this.viewComboBox = new System.Windows.Forms.ComboBox();
47      this.resultsButton = new System.Windows.Forms.Button();
48      this.SuspendLayout();
49      //
50      // viewComboBox
51      //
52      this.viewComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
53      this.viewComboBox.FormattingEnabled = true;
54      this.viewComboBox.Location = new System.Drawing.Point(3, 3);
55      this.viewComboBox.Name = "viewComboBox";
56      this.viewComboBox.Size = new System.Drawing.Size(121, 21);
57      this.viewComboBox.TabIndex = 7;
58      //
59      // resultsButton
60      //
61      this.resultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
62      this.resultsButton.Location = new System.Drawing.Point(130, 1);
63      this.resultsButton.Name = "resultsButton";
64      this.resultsButton.Size = new System.Drawing.Size(86, 23);
65      this.resultsButton.TabIndex = 6;
66      this.resultsButton.Text = "Show results";
67      this.resultsButton.UseVisualStyleBackColor = true;
68      this.resultsButton.Click += new System.EventHandler(this.resultsButton_Click);
69      //
70      // ConsoleEditor
71      //
72      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
73      this.Controls.Add(this.viewComboBox);
74      this.Controls.Add(this.resultsButton);
75      this.Name = "ConsoleEditor";
76      this.Size = new System.Drawing.Size(445, 189);
77      this.ResumeLayout(false);
78
79    }
80
81    #endregion
82
83    private void PopulateViewComboBox() {
84      DiscoveryService service = new DiscoveryService();
85      IResultsViewFactory[] factories = service.GetInstances<IResultsViewFactory>();
86      viewComboBox.DataSource = factories;
87      viewComboBox.ValueMember = "Name";
88    }
89
90
91    private void resultsButton_Click(object sender, EventArgs e) {
92      IResultsViewFactory factory = (IResultsViewFactory)viewComboBox.SelectedItem;
93      IControl control = factory.CreateView(console.Results);
94      PluginManager.ControlManager.ShowControl(control);
95    }
96  }
97}
Note: See TracBrowser for help on using the repository browser.