Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HL-3.2-MonoMigration/HeuristicLab.CEDMA.Core/ConsoleEditor.cs @ 3494

Last change on this file since 3494 was 561, checked in by gkronber, 16 years ago
  • asynchronous downloading of agents and results from the CEDMA server
  • created a chart that displays points as bubbles (scatter-plot + optional third dimension for the size of the bubble, larger bubbles are more transparent than smaller bubbles)

ticket #268 (Possibility to open the function-tree of any model (represented as point in the scatter-plot))

File size: 7.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 System.Windows.Forms.TextBox uriTextBox;
36    private System.Windows.Forms.Label uriLabel;
37    private Button connectButton;
38    private Button openOpLibButton;
39    private Label label1;
40    private Label resultsLabel;
41    private Button openResultsButton;
42    private Button openAgentsButton;
43    private Label agentsLabel;
44    private Console console;
45
46    public ConsoleEditor(Console console) {
47      InitializeComponent();
48      this.console = console;
49    }
50
51    private void InitializeComponent() {
52      this.uriTextBox = new System.Windows.Forms.TextBox();
53      this.uriLabel = new System.Windows.Forms.Label();
54      this.connectButton = new System.Windows.Forms.Button();
55      this.openOpLibButton = new System.Windows.Forms.Button();
56      this.label1 = new System.Windows.Forms.Label();
57      this.resultsLabel = new System.Windows.Forms.Label();
58      this.openResultsButton = new System.Windows.Forms.Button();
59      this.openAgentsButton = new System.Windows.Forms.Button();
60      this.agentsLabel = new System.Windows.Forms.Label();
61      this.SuspendLayout();
62      //
63      // uriTextBox
64      //
65      this.uriTextBox.Location = new System.Drawing.Point(94, 3);
66      this.uriTextBox.Name = "uriTextBox";
67      this.uriTextBox.Size = new System.Drawing.Size(205, 20);
68      this.uriTextBox.TabIndex = 0;
69      //
70      // uriLabel
71      //
72      this.uriLabel.AutoSize = true;
73      this.uriLabel.Location = new System.Drawing.Point(6, 6);
74      this.uriLabel.Name = "uriLabel";
75      this.uriLabel.Size = new System.Drawing.Size(82, 13);
76      this.uriLabel.TabIndex = 1;
77      this.uriLabel.Text = "CEDMA Server:";
78      //
79      // connectButton
80      //
81      this.connectButton.Location = new System.Drawing.Point(305, 1);
82      this.connectButton.Name = "connectButton";
83      this.connectButton.Size = new System.Drawing.Size(75, 23);
84      this.connectButton.TabIndex = 3;
85      this.connectButton.Text = "&Connect";
86      this.connectButton.UseVisualStyleBackColor = true;
87      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
88      //
89      // openOpLibButton
90      //
91      this.openOpLibButton.Enabled = false;
92      this.openOpLibButton.Location = new System.Drawing.Point(94, 85);
93      this.openOpLibButton.Name = "openOpLibButton";
94      this.openOpLibButton.Size = new System.Drawing.Size(75, 23);
95      this.openOpLibButton.TabIndex = 7;
96      this.openOpLibButton.Text = "&Open";
97      this.openOpLibButton.UseVisualStyleBackColor = true;
98      this.openOpLibButton.Click += new System.EventHandler(this.opLibButton_Click);
99      //
100      // label1
101      //
102      this.label1.AutoSize = true;
103      this.label1.Location = new System.Drawing.Point(3, 90);
104      this.label1.Name = "label1";
105      this.label1.Size = new System.Drawing.Size(85, 13);
106      this.label1.TabIndex = 8;
107      this.label1.Text = "Operator Library:";
108      //
109      // resultsLabel
110      //
111      this.resultsLabel.AutoSize = true;
112      this.resultsLabel.Location = new System.Drawing.Point(43, 61);
113      this.resultsLabel.Name = "resultsLabel";
114      this.resultsLabel.Size = new System.Drawing.Size(45, 13);
115      this.resultsLabel.TabIndex = 9;
116      this.resultsLabel.Text = "Results:";
117      //
118      // openResultsButton
119      //
120      this.openResultsButton.Enabled = false;
121      this.openResultsButton.Location = new System.Drawing.Point(94, 56);
122      this.openResultsButton.Name = "openResultsButton";
123      this.openResultsButton.Size = new System.Drawing.Size(75, 23);
124      this.openResultsButton.TabIndex = 10;
125      this.openResultsButton.Text = "&Open";
126      this.openResultsButton.UseVisualStyleBackColor = true;
127      this.openResultsButton.Click += new System.EventHandler(this.openChartButton_Click);
128      //
129      // openAgentsButton
130      //
131      this.openAgentsButton.Enabled = false;
132      this.openAgentsButton.Location = new System.Drawing.Point(94, 27);
133      this.openAgentsButton.Name = "openAgentsButton";
134      this.openAgentsButton.Size = new System.Drawing.Size(75, 23);
135      this.openAgentsButton.TabIndex = 12;
136      this.openAgentsButton.Text = "&Open";
137      this.openAgentsButton.UseVisualStyleBackColor = true;
138      this.openAgentsButton.Click += new System.EventHandler(this.openAgentsButton_Click);
139      //
140      // agentsLabel
141      //
142      this.agentsLabel.AutoSize = true;
143      this.agentsLabel.Location = new System.Drawing.Point(45, 32);
144      this.agentsLabel.Name = "agentsLabel";
145      this.agentsLabel.Size = new System.Drawing.Size(43, 13);
146      this.agentsLabel.TabIndex = 11;
147      this.agentsLabel.Text = "Agents:";
148      //
149      // ConsoleEditor
150      //
151      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
152      this.Controls.Add(this.openAgentsButton);
153      this.Controls.Add(this.agentsLabel);
154      this.Controls.Add(this.openResultsButton);
155      this.Controls.Add(this.resultsLabel);
156      this.Controls.Add(this.label1);
157      this.Controls.Add(this.openOpLibButton);
158      this.Controls.Add(this.connectButton);
159      this.Controls.Add(this.uriLabel);
160      this.Controls.Add(this.uriTextBox);
161      this.Name = "ConsoleEditor";
162      this.Size = new System.Drawing.Size(445, 189);
163      this.ResumeLayout(false);
164      this.PerformLayout();
165
166    }
167
168    private void connectButton_Click(object sender, EventArgs e) {
169      try {
170        console.Connect(uriTextBox.Text);
171        connectButton.Enabled = false;
172        openOpLibButton.Enabled = true;
173        openAgentsButton.Enabled = true;
174        openResultsButton.Enabled = true;
175      } catch(CommunicationException ex) {
176        MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message);
177      }
178    }
179
180    private void opLibButton_Click(object sender, EventArgs e) {
181      IOperatorLibrary opLib = console.OperatorLibrary;
182      if(opLib != null) {
183        IView view = opLib.CreateView();
184        if(view != null)
185          PluginManager.ControlManager.ShowControl(view);
186      }
187    }
188
189    private void openChartButton_Click(object sender, EventArgs e) {
190      PluginManager.ControlManager.ShowControl(console.ResultsList.CreateView());
191    }
192
193    private void openAgentsButton_Click(object sender, EventArgs e) {
194      PluginManager.ControlManager.ShowControl(console.AgentList.CreateView());
195    }
196  }
197}
Note: See TracBrowser for help on using the repository browser.