[7953] | 1 | using System;
|
---|
| 2 | using System.ComponentModel;
|
---|
| 3 | using System.Windows.Forms;
|
---|
[7816] | 4 | using HeuristicLab.Problems.DataAnalysis;
|
---|
[7953] | 5 | using HeuristicLab.Problems.Instances.DataAnalysis;
|
---|
[7808] | 6 |
|
---|
| 7 | namespace HeuristicLab.ExperimentGeneration.DataAnalysis.ExperimentWizard {
|
---|
| 8 | public partial class ProblemDataPage : HeuristicLab.ExperimentGeneration.DataAnalysis.Wizard.WizardPage {
|
---|
[7953] | 9 | private RegressionProblem problem;
|
---|
| 10 | private RegressionCSVInstanceProvider instanceProvider;
|
---|
| 11 |
|
---|
[7824] | 12 | private DataAnalysisWizardContext context;
|
---|
| 13 | public DataAnalysisWizardContext Context {
|
---|
| 14 | get { return context; }
|
---|
| 15 | }
|
---|
| 16 |
|
---|
| 17 | public ProblemDataPage(DataAnalysisWizardContext context) {
|
---|
[7808] | 18 | InitializeComponent();
|
---|
[7824] | 19 | this.context = context;
|
---|
[7953] | 20 | stringConvertibleMatrixView.ReadOnly = true;
|
---|
| 21 | problem = new RegressionProblem();
|
---|
| 22 | instanceProvider = new RegressionCSVInstanceProvider();
|
---|
[7808] | 23 | }
|
---|
| 24 |
|
---|
| 25 | private void ProblemDataPage_SetActive(object sender, CancelEventArgs e) {
|
---|
| 26 | SetWizardButton(Wizard.WizardButtons.Next);
|
---|
| 27 | }
|
---|
[7824] | 28 |
|
---|
| 29 | private void ProblemDataPage_WizardNext(object sender, Wizard.WizardPageEventArgs e) {
|
---|
[7953] | 30 | context.Problem = problem;
|
---|
[7824] | 31 | }
|
---|
[7953] | 32 |
|
---|
| 33 | private void btnChooseFile_Click(object sender, System.EventArgs e) {
|
---|
| 34 | OpenFileDialog fileDialog = new OpenFileDialog();
|
---|
| 35 | fileDialog.Filter = "csv files (*.csv)|*.csv|All files (*.*)|*.*";
|
---|
| 36 | if (fileDialog.ShowDialog() == DialogResult.OK) {
|
---|
| 37 | try {
|
---|
| 38 | txtFilePath.Text = fileDialog.FileName;
|
---|
| 39 | IRegressionProblemData problemData = instanceProvider.LoadData(fileDialog.FileName);
|
---|
| 40 | problem.Load(problemData);
|
---|
| 41 | stringConvertibleMatrixView.Content = problem.ProblemData.Dataset;
|
---|
| 42 | }
|
---|
| 43 | catch (Exception ex) {
|
---|
| 44 | MessageBox.Show(String.Format("There was an error parsing the file: {0}", Environment.NewLine + ex.Message), "Error while parsing", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
---|
| 45 | }
|
---|
| 46 | }
|
---|
| 47 | }
|
---|
[7808] | 48 | }
|
---|
| 49 | }
|
---|