- Timestamp:
- 08/03/09 14:23:54 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.CEDMA.Core/3.3/ConsoleEditor.cs
r2000 r2223 29 29 using HeuristicLab.PluginInfrastructure; 30 30 using System.Drawing; 31 using HeuristicLab.CEDMA.DB.Interfaces;32 31 33 32 namespace HeuristicLab.CEDMA.Core { 34 33 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; 34 private ComboBox viewComboBox; 35 private Button resultsButton; 39 36 private Console console; 40 37 … … 42 39 InitializeComponent(); 43 40 this.console = console; 41 PopulateViewComboBox(); 44 42 } 45 43 46 44 #region autogenerated code 47 45 private void InitializeComponent() { 48 this.uriTextBox = new System.Windows.Forms.TextBox(); 49 this.uriLabel = new System.Windows.Forms.Label(); 50 this.connectButton = new System.Windows.Forms.Button(); 51 this.serverPanel = new System.Windows.Forms.Panel(); 46 this.viewComboBox = new System.Windows.Forms.ComboBox(); 47 this.resultsButton = new System.Windows.Forms.Button(); 52 48 this.SuspendLayout(); 53 49 // 54 // uriTextBox50 // viewComboBox 55 51 // 56 this.uriTextBox.Location = new System.Drawing.Point(94, 3); 57 this.uriTextBox.Name = "uriTextBox"; 58 this.uriTextBox.Size = new System.Drawing.Size(205, 20); 59 this.uriTextBox.TabIndex = 0; 52 this.viewComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 53 this.viewComboBox.FormattingEnabled = true; 54 this.viewComboBox.Location = new System.Drawing.Point(3, 3); 55 this.viewComboBox.Name = "viewComboBox"; 56 this.viewComboBox.Size = new System.Drawing.Size(121, 21); 57 this.viewComboBox.TabIndex = 7; 60 58 // 61 // uriLabel59 // resultsButton 62 60 // 63 this.uriLabel.AutoSize = true; 64 this.uriLabel.Location = new System.Drawing.Point(6, 6); 65 this.uriLabel.Name = "uriLabel"; 66 this.uriLabel.Size = new System.Drawing.Size(82, 13); 67 this.uriLabel.TabIndex = 1; 68 this.uriLabel.Text = "CEDMA Server:"; 69 // 70 // connectButton 71 // 72 this.connectButton.Location = new System.Drawing.Point(305, 1); 73 this.connectButton.Name = "connectButton"; 74 this.connectButton.Size = new System.Drawing.Size(75, 23); 75 this.connectButton.TabIndex = 3; 76 this.connectButton.Text = "&Connect"; 77 this.connectButton.UseVisualStyleBackColor = true; 78 this.connectButton.Click += new System.EventHandler(this.connectButton_Click); 79 // 80 // serverPanel 81 // 82 this.serverPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 83 | System.Windows.Forms.AnchorStyles.Left) 84 | System.Windows.Forms.AnchorStyles.Right))); 85 this.serverPanel.Location = new System.Drawing.Point(3, 29); 86 this.serverPanel.Name = "serverPanel"; 87 this.serverPanel.Size = new System.Drawing.Size(439, 157); 88 this.serverPanel.TabIndex = 4; 61 this.resultsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); 62 this.resultsButton.Location = new System.Drawing.Point(130, 1); 63 this.resultsButton.Name = "resultsButton"; 64 this.resultsButton.Size = new System.Drawing.Size(86, 23); 65 this.resultsButton.TabIndex = 6; 66 this.resultsButton.Text = "Show results"; 67 this.resultsButton.UseVisualStyleBackColor = true; 68 this.resultsButton.Click += new System.EventHandler(this.resultsButton_Click); 89 69 // 90 70 // ConsoleEditor 91 71 // 92 72 this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 93 this.Controls.Add(this.serverPanel); 94 this.Controls.Add(this.connectButton); 95 this.Controls.Add(this.uriLabel); 96 this.Controls.Add(this.uriTextBox); 73 this.Controls.Add(this.viewComboBox); 74 this.Controls.Add(this.resultsButton); 97 75 this.Name = "ConsoleEditor"; 98 76 this.Size = new System.Drawing.Size(445, 189); 99 77 this.ResumeLayout(false); 100 this.PerformLayout();101 78 102 79 } … … 104 81 #endregion 105 82 106 private void connectButton_Click(object sender, EventArgs e) {107 try {108 console.Connect(uriTextBox.Text);109 connectButton.Enabled = false;110 serverPanel.Enabled = true;111 serverPanel.Controls.Clear();112 Control dataSetView = (Control)console.DataSet.CreateView(); 113 dataSetView.Dock = DockStyle.Fill; 114 serverPanel.Controls.Add(dataSetView);115 } catch(CommunicationException ex) {116 MessageBox.Show("Exception while trying to connect to " + uriTextBox.Text + "\n" + ex.Message);117 }83 private void PopulateViewComboBox() { 84 DiscoveryService service = new DiscoveryService(); 85 IResultsViewFactory[] factories = service.GetInstances<IResultsViewFactory>(); 86 viewComboBox.DataSource = factories; 87 viewComboBox.ValueMember = "Name"; 88 } 89 90 91 private void resultsButton_Click(object sender, EventArgs e) { 92 IResultsViewFactory factory = (IResultsViewFactory)viewComboBox.SelectedItem; 93 IControl control = factory.CreateView(console.Results); 94 PluginManager.ControlManager.ShowControl(control); 118 95 } 119 96 }
Note: See TracChangeset
for help on using the changeset viewer.