Free cookie consent management tool by TermsFeed Policy Generator

Changeset 359 for trunk


Ignore:
Timestamp:
07/02/08 19:59:39 (16 years ago)
Author:
gkronber
Message:

worked on #187

Location:
trunk/sources/HeuristicLab.CEDMA.Console
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Console/Console.cs

    r357 r359  
    1717    public string ServerUri {
    1818      get { return serverUri; }
    19       set {
    20         serverUri = value;
    21         ResetConnection();
    22       }
    2319    }
    2420
     
    5147    public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) {
    5248      base.Populate(node, restoredObjects);
    53       ServerUri = node.Attributes["ServerURI"].Value;
     49      serverUri = node.Attributes["ServerURI"].Value;
    5450    }
    5551    #endregion
     
    6763    }
    6864    #endregion
     65
     66    internal void Connect(string serverUri) {
     67      this.serverUri = serverUri;
     68      ResetConnection();
     69    }
    6970  }
    7071}
  • trunk/sources/HeuristicLab.CEDMA.Console/ConsoleEditor.cs

    r357 r359  
    55using HeuristicLab.Core;
    66using System.Windows.Forms;
     7using System.ServiceModel;
    78
    89namespace HeuristicLab.CEDMA.Console {
     
    1415    private System.Windows.Forms.TabPage agentsPage;
    1516    private System.Windows.Forms.TabPage resultsPage;
     17    private Button connectButton;
    1618    private Console console;
    1719
    1820    public ConsoleEditor(Console console) {
     21      InitializeComponent();
    1922      this.console = console;
    20       agentsPage.Controls.Add((Control)console.AgentList.CreateView());
    2123    }
    2224
     
    2830      this.agentsPage = new System.Windows.Forms.TabPage();
    2931      this.resultsPage = new System.Windows.Forms.TabPage();
     32      this.connectButton = new System.Windows.Forms.Button();
    3033      this.tabControl.SuspendLayout();
    31       this.agentsPage.SuspendLayout();
    3234      this.SuspendLayout();
    3335      //
     
    3840      this.uriTextBox.Size = new System.Drawing.Size(205, 20);
    3941      this.uriTextBox.TabIndex = 0;
    40       this.uriTextBox.Validated += new System.EventHandler(this.uriTextBox_Validated);
    4142      //
    4243      // uriLabel
     
    5758      this.tabControl.Controls.Add(this.agentsPage);
    5859      this.tabControl.Controls.Add(this.resultsPage);
     60      this.tabControl.Enabled = false;
    5961      this.tabControl.Location = new System.Drawing.Point(6, 29);
    6062      this.tabControl.Name = "tabControl";
    6163      this.tabControl.SelectedIndex = 0;
    62       this.tabControl.Size = new System.Drawing.Size(310, 242);
     64      this.tabControl.Size = new System.Drawing.Size(407, 242);
    6365      this.tabControl.TabIndex = 2;
    6466      //
     
    6870      this.overviewPage.Name = "overviewPage";
    6971      this.overviewPage.Padding = new System.Windows.Forms.Padding(3);
    70       this.overviewPage.Size = new System.Drawing.Size(288, 194);
     72      this.overviewPage.Size = new System.Drawing.Size(399, 216);
    7173      this.overviewPage.TabIndex = 0;
    7274      this.overviewPage.Text = "Overview";
     
    7880      this.agentsPage.Name = "agentsPage";
    7981      this.agentsPage.Padding = new System.Windows.Forms.Padding(3);
    80       this.agentsPage.Size = new System.Drawing.Size(302, 216);
     82      this.agentsPage.Size = new System.Drawing.Size(399, 216);
    8183      this.agentsPage.TabIndex = 1;
    8284      this.agentsPage.Text = "Agents";
     
    8890      this.resultsPage.Name = "resultsPage";
    8991      this.resultsPage.Padding = new System.Windows.Forms.Padding(3);
    90       this.resultsPage.Size = new System.Drawing.Size(288, 194);
     92      this.resultsPage.Size = new System.Drawing.Size(399, 216);
    9193      this.resultsPage.TabIndex = 2;
    9294      this.resultsPage.Text = "Results";
    9395      this.resultsPage.UseVisualStyleBackColor = true;
    9496      //
     97      // connectButton
     98      //
     99      this.connectButton.Location = new System.Drawing.Point(302, 1);
     100      this.connectButton.Name = "connectButton";
     101      this.connectButton.Size = new System.Drawing.Size(75, 23);
     102      this.connectButton.TabIndex = 3;
     103      this.connectButton.Text = "&Connect";
     104      this.connectButton.UseVisualStyleBackColor = true;
     105      this.connectButton.Click += new System.EventHandler(this.connectButton_Click);
     106      //
    95107      // ConsoleEditor
    96108      //
    97109      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     110      this.Controls.Add(this.connectButton);
    98111      this.Controls.Add(this.tabControl);
    99112      this.Controls.Add(this.uriLabel);
    100113      this.Controls.Add(this.uriTextBox);
    101114      this.Name = "ConsoleEditor";
    102       this.Size = new System.Drawing.Size(319, 274);
     115      this.Size = new System.Drawing.Size(416, 274);
    103116      this.tabControl.ResumeLayout(false);
    104       this.agentsPage.ResumeLayout(false);
    105117      this.ResumeLayout(false);
    106118      this.PerformLayout();
     
    108120    }
    109121
    110     private void uriTextBox_Validated(object sender, EventArgs e) {
    111       console.ServerUri = uriTextBox.Text;
     122    private void connectButton_Click(object sender, EventArgs e) {
     123      try {
     124        console.Connect(uriTextBox.Text);
     125        connectButton.Enabled = false;
     126        tabControl.Enabled = true;
     127        agentsPage.Controls.Add((Control)console.AgentList.CreateView());
     128      } catch(CommunicationException ex) {
     129        // TASK create helper class for error reporting
     130        MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message);
     131      }
    112132    }
    113133  }
Note: See TracChangeset for help on using the changeset viewer.