[372] | 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 |
|
---|
| 22 | using System;
|
---|
[357] | 23 | using System.Collections.Generic;
|
---|
| 24 | using System.Linq;
|
---|
| 25 | using System.Text;
|
---|
| 26 | using HeuristicLab.Core;
|
---|
| 27 | using System.Windows.Forms;
|
---|
[359] | 28 | using System.ServiceModel;
|
---|
[417] | 29 | using HeuristicLab.PluginInfrastructure;
|
---|
[553] | 30 | using System.Drawing;
|
---|
| 31 | using HeuristicLab.CEDMA.DB.Interfaces;
|
---|
[357] | 32 |
|
---|
[377] | 33 | namespace HeuristicLab.CEDMA.Core {
|
---|
[357] | 34 | class ConsoleEditor : EditorBase {
|
---|
| 35 | private System.Windows.Forms.TextBox uriTextBox;
|
---|
| 36 | private System.Windows.Forms.Label uriLabel;
|
---|
[359] | 37 | private Button connectButton;
|
---|
[1287] | 38 | private Panel serverPanel;
|
---|
[357] | 39 | private Console console;
|
---|
| 40 |
|
---|
| 41 | public ConsoleEditor(Console console) {
|
---|
[359] | 42 | InitializeComponent();
|
---|
[357] | 43 | this.console = console;
|
---|
[1287] | 44 | serverPanel.Enabled = false;
|
---|
[357] | 45 | }
|
---|
| 46 |
|
---|
[1287] | 47 | #region autogenerated code
|
---|
[357] | 48 | private void InitializeComponent() {
|
---|
| 49 | this.uriTextBox = new System.Windows.Forms.TextBox();
|
---|
| 50 | this.uriLabel = new System.Windows.Forms.Label();
|
---|
[359] | 51 | this.connectButton = new System.Windows.Forms.Button();
|
---|
[1287] | 52 | this.serverPanel = new System.Windows.Forms.Panel();
|
---|
[357] | 53 | this.SuspendLayout();
|
---|
| 54 | //
|
---|
| 55 | // uriTextBox
|
---|
| 56 | //
|
---|
[417] | 57 | this.uriTextBox.Location = new System.Drawing.Point(94, 3);
|
---|
[357] | 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;
|
---|
[561] | 65 | this.uriLabel.Location = new System.Drawing.Point(6, 6);
|
---|
[357] | 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 | //
|
---|
[359] | 71 | // connectButton
|
---|
| 72 | //
|
---|
[417] | 73 | this.connectButton.Location = new System.Drawing.Point(305, 1);
|
---|
[359] | 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 | //
|
---|
[1287] | 81 | // serverPanel
|
---|
[372] | 82 | //
|
---|
[1287] | 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;
|
---|
[372] | 90 | //
|
---|
[357] | 91 | // ConsoleEditor
|
---|
| 92 | //
|
---|
| 93 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
---|
[1287] | 94 | this.Controls.Add(this.serverPanel);
|
---|
[359] | 95 | this.Controls.Add(this.connectButton);
|
---|
[357] | 96 | this.Controls.Add(this.uriLabel);
|
---|
| 97 | this.Controls.Add(this.uriTextBox);
|
---|
| 98 | this.Name = "ConsoleEditor";
|
---|
[561] | 99 | this.Size = new System.Drawing.Size(445, 189);
|
---|
[357] | 100 | this.ResumeLayout(false);
|
---|
| 101 | this.PerformLayout();
|
---|
| 102 |
|
---|
| 103 | }
|
---|
| 104 |
|
---|
[1287] | 105 | #endregion
|
---|
| 106 |
|
---|
[359] | 107 | private void connectButton_Click(object sender, EventArgs e) {
|
---|
| 108 | try {
|
---|
| 109 | console.Connect(uriTextBox.Text);
|
---|
| 110 | connectButton.Enabled = false;
|
---|
[1287] | 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);
|
---|
[359] | 116 | } catch(CommunicationException ex) {
|
---|
| 117 | MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message);
|
---|
| 118 | }
|
---|
[357] | 119 | }
|
---|
| 120 | }
|
---|
| 121 | }
|
---|