Free cookie consent management tool by TermsFeed Policy Generator

Changeset 2273 for trunk


Ignore:
Timestamp:
08/10/09 16:21:09 (15 years ago)
Author:
gkronber
Message:

Added functionality to open any database file to CEDMA console. #712

Location:
trunk/sources/HeuristicLab.CEDMA.Core/3.3
Files:
2 edited

Legend:

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

    r2223 r2273  
    3333namespace HeuristicLab.CEDMA.Core {
    3434  public class Console : ItemBase, IEditable {
    35     private static readonly string sqlServerCompactFile = AppDomain.CurrentDomain.BaseDirectory + "HeuristicLab.Modeling.database.sdf";
    36     private static readonly string sqlServerCompactConnectionString = @"Data Source=" + sqlServerCompactFile;
     35    private static readonly string sqlServerCompactConnectionString = @"Data Source=";
     36
     37    private string database;
     38    public string Database {
     39      get {
     40        return database;
     41      }
     42      set {
     43        if (value != database) {
     44          database = value;
     45          results = null;
     46        }
     47      }
     48    }
    3749
    3850    private Results results;
     
    5668
    5769    private void ReloadResults() {
    58       results = new Results(new DatabaseService(sqlServerCompactConnectionString));
     70      results = new Results(new DatabaseService(sqlServerCompactConnectionString + Database));
    5971    }
    6072  }
  • trunk/sources/HeuristicLab.CEDMA.Core/3.3/ConsoleEditor.cs

    r2223 r2273  
    3434    private ComboBox viewComboBox;
    3535    private Button resultsButton;
     36    private Button openButton;
    3637    private Console console;
    3738
     
    3940      InitializeComponent();
    4041      this.console = console;
     42      resultsButton.Enabled = false;
     43      viewComboBox.Enabled = false;
    4144      PopulateViewComboBox();
    4245    }
     
    4649      this.viewComboBox = new System.Windows.Forms.ComboBox();
    4750      this.resultsButton = new System.Windows.Forms.Button();
     51      this.openButton = new System.Windows.Forms.Button();
    4852      this.SuspendLayout();
    4953      //
    5054      // viewComboBox
    5155      //
    52       this.viewComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
    5356      this.viewComboBox.FormattingEnabled = true;
    54       this.viewComboBox.Location = new System.Drawing.Point(3, 3);
     57      this.viewComboBox.Location = new System.Drawing.Point(0, 29);
    5558      this.viewComboBox.Name = "viewComboBox";
    5659      this.viewComboBox.Size = new System.Drawing.Size(121, 21);
     
    5962      // resultsButton
    6063      //
    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);
     64      this.resultsButton.Location = new System.Drawing.Point(127, 27);
    6365      this.resultsButton.Name = "resultsButton";
    6466      this.resultsButton.Size = new System.Drawing.Size(86, 23);
     
    6870      this.resultsButton.Click += new System.EventHandler(this.resultsButton_Click);
    6971      //
     72      // openButton
     73      //
     74      this.openButton.Location = new System.Drawing.Point(4, 0);
     75      this.openButton.Name = "openButton";
     76      this.openButton.Size = new System.Drawing.Size(75, 23);
     77      this.openButton.TabIndex = 8;
     78      this.openButton.Text = "Open...";
     79      this.openButton.UseVisualStyleBackColor = true;
     80      this.openButton.Click += new System.EventHandler(this.openButton_Click);
     81      //
    7082      // ConsoleEditor
    7183      //
    7284      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     85      this.Controls.Add(this.openButton);
    7386      this.Controls.Add(this.viewComboBox);
    7487      this.Controls.Add(this.resultsButton);
    7588      this.Name = "ConsoleEditor";
    76       this.Size = new System.Drawing.Size(445, 189);
     89      this.Size = new System.Drawing.Size(224, 112);
    7790      this.ResumeLayout(false);
    7891
     
    94107      PluginManager.ControlManager.ShowControl(control);
    95108    }
     109
     110    private void openButton_Click(object sender, EventArgs e) {
     111      OpenFileDialog dialog = new OpenFileDialog();
     112      DialogResult result = dialog.ShowDialog();
     113      if (result == DialogResult.OK) {
     114        viewComboBox.Enabled = true;
     115        resultsButton.Enabled = true;
     116        console.Database = dialog.FileName;
     117      }
     118    }
    96119  }
    97120}
Note: See TracChangeset for help on using the changeset viewer.