#region License Information /* HeuristicLab * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL) * * This file is part of HeuristicLab. * * HeuristicLab is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * HeuristicLab is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with HeuristicLab. If not, see . */ #endregion using System; using System.Collections.Generic; using System.Linq; using System.Text; using HeuristicLab.Core; using System.Windows.Forms; using System.ServiceModel; using HeuristicLab.PluginInfrastructure; using System.Drawing; using HeuristicLab.CEDMA.DB.Interfaces; namespace HeuristicLab.CEDMA.Core { class ConsoleEditor : EditorBase { private System.Windows.Forms.TextBox uriTextBox; private System.Windows.Forms.Label uriLabel; private Button connectButton; private Panel serverPanel; private Console console; public ConsoleEditor(Console console) { InitializeComponent(); this.console = console; serverPanel.Enabled = false; } #region autogenerated code private void InitializeComponent() { this.uriTextBox = new System.Windows.Forms.TextBox(); this.uriLabel = new System.Windows.Forms.Label(); this.connectButton = new System.Windows.Forms.Button(); this.serverPanel = new System.Windows.Forms.Panel(); this.SuspendLayout(); // // uriTextBox // this.uriTextBox.Location = new System.Drawing.Point(94, 3); this.uriTextBox.Name = "uriTextBox"; this.uriTextBox.Size = new System.Drawing.Size(205, 20); this.uriTextBox.TabIndex = 0; // // uriLabel // this.uriLabel.AutoSize = true; this.uriLabel.Location = new System.Drawing.Point(6, 6); this.uriLabel.Name = "uriLabel"; this.uriLabel.Size = new System.Drawing.Size(82, 13); this.uriLabel.TabIndex = 1; this.uriLabel.Text = "CEDMA Server:"; // // connectButton // this.connectButton.Location = new System.Drawing.Point(305, 1); this.connectButton.Name = "connectButton"; this.connectButton.Size = new System.Drawing.Size(75, 23); this.connectButton.TabIndex = 3; this.connectButton.Text = "&Connect"; this.connectButton.UseVisualStyleBackColor = true; this.connectButton.Click += new System.EventHandler(this.connectButton_Click); // // serverPanel // this.serverPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.serverPanel.Location = new System.Drawing.Point(3, 29); this.serverPanel.Name = "serverPanel"; this.serverPanel.Size = new System.Drawing.Size(439, 157); this.serverPanel.TabIndex = 4; // // ConsoleEditor // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.Controls.Add(this.serverPanel); this.Controls.Add(this.connectButton); this.Controls.Add(this.uriLabel); this.Controls.Add(this.uriTextBox); this.Name = "ConsoleEditor"; this.Size = new System.Drawing.Size(445, 189); this.ResumeLayout(false); this.PerformLayout(); } #endregion private void connectButton_Click(object sender, EventArgs e) { try { console.Connect(uriTextBox.Text); connectButton.Enabled = false; serverPanel.Enabled = true; serverPanel.Controls.Clear(); Control dataSetListView = (Control)console.DataSetList.CreateView(); dataSetListView.Dock = DockStyle.Fill; serverPanel.Controls.Add(dataSetListView); } catch(CommunicationException ex) { MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message); } } } }