Free cookie consent management tool by TermsFeed Policy Generator

source: branches/plugins/HeuristicLab.CEDMA.Core/3.2/ConsoleEditor.cs @ 2553

Last change on this file since 2553 was 988, checked in by gkronber, 16 years ago

worked on #419 (Refactor CEDMA plugins)

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