Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/03/09 14:23:54 (15 years ago)
Author:
mkommend
Message:

reintegrated branch new heuristic.modeling database backend (ticket #712)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/ConsoleEditor.cs

    r2000 r2223  
    2929using HeuristicLab.PluginInfrastructure;
    3030using System.Drawing;
    31 using HeuristicLab.CEDMA.DB.Interfaces;
    3231
    3332namespace HeuristicLab.CEDMA.Core {
    3433  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;
    3936    private Console console;
    4037
     
    4239      InitializeComponent();
    4340      this.console = console;
     41      PopulateViewComboBox();
    4442    }
    4543
    4644    #region autogenerated code
    4745    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();
    5248      this.SuspendLayout();
    5349      //
    54       // uriTextBox
     50      // viewComboBox
    5551      //
    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;
    6058      //
    61       // uriLabel
     59      // resultsButton
    6260      //
    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);
    8969      //
    9070      // ConsoleEditor
    9171      //
    9272      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);
    9775      this.Name = "ConsoleEditor";
    9876      this.Size = new System.Drawing.Size(445, 189);
    9977      this.ResumeLayout(false);
    100       this.PerformLayout();
    10178
    10279    }
     
    10481    #endregion
    10582
    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);
    11895    }
    11996  }
Note: See TracChangeset for help on using the changeset viewer.