Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/24/11 15:41:17 (13 years ago)
Author:
epitzer
Message:

Enable export of Cache to CSV file. (#1516)

Location:
trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/EvaluationCacheView.Designer.cs

    r6169 r6265  
    2727      this.hits_sizeTextBox = new System.Windows.Forms.TextBox();
    2828      this.clearButton = new System.Windows.Forms.Button();
     29      this.saveFileDialog = new System.Windows.Forms.SaveFileDialog();
     30      this.saveButton = new System.Windows.Forms.Button();
    2931      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    3032      this.SuspendLayout();
     
    5658      this.hits_sizeTextBox.Name = "hits_sizeTextBox";
    5759      this.hits_sizeTextBox.ReadOnly = true;
    58       this.hits_sizeTextBox.Size = new System.Drawing.Size(379, 20);
     60      this.hits_sizeTextBox.Size = new System.Drawing.Size(319, 20);
    5961      this.hits_sizeTextBox.TabIndex = 5;
    6062      //
     
    7173      this.clearButton.Click += new System.EventHandler(this.clearButton_Click);
    7274      //
     75      // saveFileDialog
     76      //
     77      this.saveFileDialog.DefaultExt = "csv";
     78      this.saveFileDialog.Filter = "CSV Files|*.csv|All Files|*.*";
     79      this.saveFileDialog.RestoreDirectory = true;
     80      this.saveFileDialog.Title = "Save Cache";
     81      //
     82      // saveButton
     83      //
     84      this.saveButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
     85      this.saveButton.Location = new System.Drawing.Point(384, 23);
     86      this.saveButton.Name = "saveButton";
     87      this.saveButton.Size = new System.Drawing.Size(54, 23);
     88      this.saveButton.TabIndex = 8;
     89      this.saveButton.Text = "Save...";
     90      this.saveButton.UseVisualStyleBackColor = true;
     91      this.saveButton.Click += new System.EventHandler(this.saveButton_Click);
     92      //
    7393      // EvaluationCacheView
    7494      //
     
    7898      this.Controls.Add(this.hits_sizeLabel);
    7999      this.Controls.Add(this.clearButton);
     100      this.Controls.Add(this.saveButton);
    80101      this.Name = "EvaluationCacheView";
     102      this.Controls.SetChildIndex(this.saveButton, 0);
    81103      this.Controls.SetChildIndex(this.clearButton, 0);
    82104      this.Controls.SetChildIndex(this.hits_sizeLabel, 0);
     
    97119    private System.Windows.Forms.TextBox hits_sizeTextBox;
    98120    private System.Windows.Forms.Button clearButton;
     121    private System.Windows.Forms.SaveFileDialog saveFileDialog;
     122    private System.Windows.Forms.Button saveButton;
    99123  }
    100124}
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/EvaluationCacheView.cs

    r6183 r6265  
    33using HeuristicLab.Core.Views;
    44using HeuristicLab.MainForm;
     5using System.Threading;
     6using System.IO;
     7using System.ComponentModel;
    58
    69namespace HeuristicLab.Problems.ExternalEvaluation.Views {
     
    5558      base.SetEnabledStateOfControls();
    5659      clearButton.Enabled = !ReadOnly && Content != null;
     60      saveButton.Enabled = !ReadOnly && Content != null;
    5761    }
    5862
     
    6266    }
    6367    #endregion
     68   
     69    private void saveButton_Click(object sender, EventArgs e) {
     70      if (saveFileDialog.ShowDialog() == DialogResult.OK) {
     71        saveButton.Enabled = false;
     72        BackgroundWorker worker = new BackgroundWorker();
     73        worker.DoWork += (s, a) => {
     74          Content.Save((string)a.Argument);
     75        };
     76        worker.RunWorkerCompleted += (s, a) => {
     77          SetEnabledStateOfControls();
     78        };
     79        worker.RunWorkerAsync(saveFileDialog.FileName);
     80      }
     81    }   
    6482  }
    6583}
  • trunk/sources/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/EvaluationCacheView.resx

    r6169 r6265  
    121121    <value>107, 17</value>
    122122  </metadata>
    123   <metadata name="errorProvider.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124     <value>107, 17</value>
    125   </metadata>
    126123  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    127124    <value>17, 17</value>
    128125  </metadata>
     126  <metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     127    <value>230, 17</value>
     128  </metadata>
    129129</root>
Note: See TracChangeset for help on using the changeset viewer.