Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Modeling Database Backend/sources/HeuristicLab.CEDMA.Core/3.3/ConsoleEditor.cs @ 2204

Last change on this file since 2204 was 2190, checked in by gkronber, 15 years ago

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