Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 2160 was 2000, checked in by gkronber, 15 years ago

Refactoring: changed CEDMA backend to use a single data set per RDF results database. #656 (CEDMA server should handle only one data set (problem) at a time)

File size: 4.4 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 Panel serverPanel;
39    private Console console;
40
41    public ConsoleEditor(Console console) {
42      InitializeComponent();
43      this.console = console;
44    }
45
46    #region autogenerated code
47    private void InitializeComponent() {
48      this.uriTextBox = new System.Windows.Forms.TextBox();
49      this.uriLabel = new System.Windows.Forms.Label();
50      this.connectButton = new System.Windows.Forms.Button();
51      this.serverPanel = new System.Windows.Forms.Panel();
52      this.SuspendLayout();
53      //
54      // uriTextBox
55      //
56      this.uriTextBox.Location = new System.Drawing.Point(94, 3);
57      this.uriTextBox.Name = "uriTextBox";
58      this.uriTextBox.Size = new System.Drawing.Size(205, 20);
59      this.uriTextBox.TabIndex = 0;
60      //
61      // uriLabel
62      //
63      this.uriLabel.AutoSize = true;
64      this.uriLabel.Location = new System.Drawing.Point(6, 6);
65      this.uriLabel.Name = "uriLabel";
66      this.uriLabel.Size = new System.Drawing.Size(82, 13);
67      this.uriLabel.TabIndex = 1;
68      this.uriLabel.Text = "CEDMA Server:";
69      //
70      // connectButton
71      //
72      this.connectButton.Location = new System.Drawing.Point(305, 1);
73      this.connectButton.Name = "connectButton";
74      this.connectButton.Size = new System.Drawing.Size(75, 23);
75      this.connectButton.TabIndex = 3;
76      this.connectButton.Text = "&Connect";
77      this.connectButton.UseVisualStyleBackColor = true;
78      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
79      //
80      // serverPanel
81      //
82      this.serverPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
83                  | System.Windows.Forms.AnchorStyles.Left)
84                  | System.Windows.Forms.AnchorStyles.Right)));
85      this.serverPanel.Location = new System.Drawing.Point(3, 29);
86      this.serverPanel.Name = "serverPanel";
87      this.serverPanel.Size = new System.Drawing.Size(439, 157);
88      this.serverPanel.TabIndex = 4;
89      //
90      // ConsoleEditor
91      //
92      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
93      this.Controls.Add(this.serverPanel);
94      this.Controls.Add(this.connectButton);
95      this.Controls.Add(this.uriLabel);
96      this.Controls.Add(this.uriTextBox);
97      this.Name = "ConsoleEditor";
98      this.Size = new System.Drawing.Size(445, 189);
99      this.ResumeLayout(false);
100      this.PerformLayout();
101
102    }
103
104    #endregion
105
106    private void connectButton_Click(object sender, EventArgs e) {
107      try {
108        console.Connect(uriTextBox.Text);
109        connectButton.Enabled = false;
110        serverPanel.Enabled = true;
111        serverPanel.Controls.Clear();
112        Control dataSetView = (Control)console.DataSet.CreateView();
113        dataSetView.Dock = DockStyle.Fill;
114        serverPanel.Controls.Add(dataSetView);
115      } catch(CommunicationException ex) {
116        MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message);
117      }
118    }
119  }
120}
Note: See TracBrowser for help on using the repository browser.