Changeset 359
- Timestamp:
- 07/02/08 19:59:39 (16 years ago)
- Location:
- trunk/sources/HeuristicLab.CEDMA.Console
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Console/Console.cs
r357 r359 17 17 public string ServerUri { 18 18 get { return serverUri; } 19 set {20 serverUri = value;21 ResetConnection();22 }23 19 } 24 20 … … 51 47 public override void Populate(XmlNode node, IDictionary<Guid, IStorable> restoredObjects) { 52 48 base.Populate(node, restoredObjects); 53 ServerUri = node.Attributes["ServerURI"].Value;49 serverUri = node.Attributes["ServerURI"].Value; 54 50 } 55 51 #endregion … … 67 63 } 68 64 #endregion 65 66 internal void Connect(string serverUri) { 67 this.serverUri = serverUri; 68 ResetConnection(); 69 } 69 70 } 70 71 } -
trunk/sources/HeuristicLab.CEDMA.Console/ConsoleEditor.cs
r357 r359 5 5 using HeuristicLab.Core; 6 6 using System.Windows.Forms; 7 using System.ServiceModel; 7 8 8 9 namespace HeuristicLab.CEDMA.Console { … … 14 15 private System.Windows.Forms.TabPage agentsPage; 15 16 private System.Windows.Forms.TabPage resultsPage; 17 private Button connectButton; 16 18 private Console console; 17 19 18 20 public ConsoleEditor(Console console) { 21 InitializeComponent(); 19 22 this.console = console; 20 agentsPage.Controls.Add((Control)console.AgentList.CreateView());21 23 } 22 24 … … 28 30 this.agentsPage = new System.Windows.Forms.TabPage(); 29 31 this.resultsPage = new System.Windows.Forms.TabPage(); 32 this.connectButton = new System.Windows.Forms.Button(); 30 33 this.tabControl.SuspendLayout(); 31 this.agentsPage.SuspendLayout();32 34 this.SuspendLayout(); 33 35 // … … 38 40 this.uriTextBox.Size = new System.Drawing.Size(205, 20); 39 41 this.uriTextBox.TabIndex = 0; 40 this.uriTextBox.Validated += new System.EventHandler(this.uriTextBox_Validated);41 42 // 42 43 // uriLabel … … 57 58 this.tabControl.Controls.Add(this.agentsPage); 58 59 this.tabControl.Controls.Add(this.resultsPage); 60 this.tabControl.Enabled = false; 59 61 this.tabControl.Location = new System.Drawing.Point(6, 29); 60 62 this.tabControl.Name = "tabControl"; 61 63 this.tabControl.SelectedIndex = 0; 62 this.tabControl.Size = new System.Drawing.Size( 310, 242);64 this.tabControl.Size = new System.Drawing.Size(407, 242); 63 65 this.tabControl.TabIndex = 2; 64 66 // … … 68 70 this.overviewPage.Name = "overviewPage"; 69 71 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); 71 73 this.overviewPage.TabIndex = 0; 72 74 this.overviewPage.Text = "Overview"; … … 78 80 this.agentsPage.Name = "agentsPage"; 79 81 this.agentsPage.Padding = new System.Windows.Forms.Padding(3); 80 this.agentsPage.Size = new System.Drawing.Size(3 02, 216);82 this.agentsPage.Size = new System.Drawing.Size(399, 216); 81 83 this.agentsPage.TabIndex = 1; 82 84 this.agentsPage.Text = "Agents"; … … 88 90 this.resultsPage.Name = "resultsPage"; 89 91 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); 91 93 this.resultsPage.TabIndex = 2; 92 94 this.resultsPage.Text = "Results"; 93 95 this.resultsPage.UseVisualStyleBackColor = true; 94 96 // 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 // 95 107 // ConsoleEditor 96 108 // 97 109 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 110 this.Controls.Add(this.connectButton); 98 111 this.Controls.Add(this.tabControl); 99 112 this.Controls.Add(this.uriLabel); 100 113 this.Controls.Add(this.uriTextBox); 101 114 this.Name = "ConsoleEditor"; 102 this.Size = new System.Drawing.Size( 319, 274);115 this.Size = new System.Drawing.Size(416, 274); 103 116 this.tabControl.ResumeLayout(false); 104 this.agentsPage.ResumeLayout(false);105 117 this.ResumeLayout(false); 106 118 this.PerformLayout(); … … 108 120 } 109 121 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 } 112 132 } 113 133 }
Note: See TracChangeset
for help on using the changeset viewer.