Changeset 7487 for branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs
- Timestamp:
- 02/20/12 11:17:24 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/ChangeDatasetOfRegressionModel/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs
r7468 r7487 27 27 using HeuristicLab.Core; 28 28 using HeuristicLab.MainForm; 29 using HeuristicLab.Persistence.Core; 29 30 using HeuristicLab.Persistence.Default.Xml; 30 31 using HeuristicLab.PluginInfrastructure; 32 using ICSharpCode.SharpZipLib.Zip; 31 33 32 34 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 62 64 #endregion 63 65 64 pr ivatevoid importButton_Click(object sender, EventArgs e) {66 protected void importButton_Click(object sender, EventArgs e) { 65 67 if (openFileDialog.ShowDialog(this) != DialogResult.OK) return; 68 ImportProblemData(openFileDialog.FileName); 69 } 66 70 71 protected void ImportProblemData(string filename) { 67 72 object hlFile = null; 68 73 try { 69 hlFile = XmlParser.Deserialize( openFileDialog.FileName);74 hlFile = XmlParser.Deserialize(filename); 70 75 } 71 catch (Exception ex) { 76 catch (PersistenceException ex) { 77 ErrorHandling.ShowErrorDialog(this, ex); 78 return; 79 } 80 catch (ZipException ex) { 72 81 ErrorHandling.ShowErrorDialog(this, ex); 73 82 return; … … 84 93 85 94 if (problemData == null) { 86 ErrorHandling.ShowErrorDialog(this, 87 new NullReferenceException("The problem data is null." + Environment.NewLine 88 + "The .hl-file is no RegressionProblemData or RegressionProblem.")); 95 ErrorHandling.ShowErrorDialog(this, new NullReferenceException("The problem data is null." + Environment.NewLine 96 + "The .hl-file is no RegressionProblemData or RegressionProblem.")); 89 97 return; 90 98 } 91 99 100 if (CheckCompatibilityOfProblemData(Content.ProblemData, problemData)) 101 Content.ProblemData = problemData; 102 } 103 104 protected virtual bool CheckCompatibilityOfProblemData(IRegressionProblemData iRegressionProblemData, IRegressionProblemData problemData) { 92 105 StringBuilder message = new StringBuilder(); 93 106 if (!problemData.TargetVariable.Equals(Content.ProblemData.TargetVariable)) … … 102 115 } 103 116 104 if (message.Length != 0) 105 ErrorHandling.ShowErrorDialog(this, new Exception(message.ToString()));106 else107 Content.ProblemData = problemData;108 117 if (message.Length != 0) { 118 ErrorHandling.ShowErrorDialog(this, new InvalidOperationException(message.ToString())); 119 return false; 120 } 121 return true; 109 122 } 110 123 }
Note: See TracChangeset
for help on using the changeset viewer.