- Timestamp:
- 12/02/13 15:13:37 (11 years ago)
- Location:
- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/ClassificationSolutionView.cs
r10173 r10174 20 20 #endregion 21 21 22 using System; 22 23 using System.Windows.Forms; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.MainForm; 26 using HeuristicLab.PluginInfrastructure; 25 27 26 28 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 51 53 } 52 54 #endregion 55 56 protected override bool CheckCompatibilityOfProblemData(IDataAnalysisProblemData problemData) { 57 IClassificationProblemData classificationProblemData = (IClassificationProblemData)problemData; 58 59 if (!classificationProblemData.TargetVariable.Equals(Content.ProblemData.TargetVariable)) { 60 string message = "The target variables are not matching. Old target variable: '" 61 + Content.ProblemData.TargetVariable 62 + "'. New targetvariable: '" + classificationProblemData.TargetVariable + "'"; 63 ErrorHandling.ShowErrorDialog(this, new InvalidOperationException(message)); 64 return false; 65 } 66 67 return base.CheckCompatibilityOfProblemData(problemData); 68 } 53 69 } 54 70 } -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
r10173 r10174 25 25 using System.Drawing; 26 26 using System.Linq; 27 using System.Text; 27 28 using System.Windows.Forms; 28 29 using HeuristicLab.Core; … … 205 206 206 207 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 207 if (e.Effect != DragDropEffects.None) { 208 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 209 if (dropData is IDataAnalysisProblemData) { 210 DataAnalysisProblemData problemData = (DataAnalysisProblemData)dropData; 211 Content.ProblemData = (DataAnalysisProblemData)problemData.Clone(); 212 } else if (dropData is IDataAnalysisProblem) { 213 IDataAnalysisProblemData problemData = ((IDataAnalysisProblem)dropData).ProblemData; 214 Content.ProblemData = (IDataAnalysisProblemData)problemData.Clone(); 215 } else if (dropData is IValueParameter) { 216 var param = (IValueParameter)dropData; 217 DataAnalysisProblemData problemData = param.Value as DataAnalysisProblemData; 218 if (problemData != null) 219 Content.ProblemData = (DataAnalysisProblemData)problemData.Clone(); 220 } 221 } 208 if (e.Effect == DragDropEffects.None) return; 209 210 IDataAnalysisProblemData problemData = null; 211 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 212 if (dropData is IDataAnalysisProblemData) 213 problemData = (IDataAnalysisProblemData)dropData; 214 else if (dropData is IDataAnalysisProblem) 215 problemData = ((IDataAnalysisProblem)dropData).ProblemData; 216 else if (dropData is IValueParameter) { 217 var param = (IValueParameter)dropData; 218 problemData = param.Value as DataAnalysisProblemData; 219 } 220 if (problemData == null) return; 221 CheckCompatibilityOfProblemData(problemData); 222 Content.ProblemData = (IDataAnalysisProblemData)problemData.Clone(); 223 } 224 #endregion 225 226 #region load problem data 227 protected virtual bool CheckCompatibilityOfProblemData(IDataAnalysisProblemData problemData) { 228 StringBuilder message = new StringBuilder(); 229 List<string> variables = problemData.InputVariables.Select(x => x.Value).ToList(); 230 foreach (var item in Content.ProblemData.InputVariables.CheckedItems) { 231 if (!variables.Contains(item.Value.Value)) 232 message.AppendLine("Input variable '" + item.Value.Value + "' is not in the new problem data."); 233 } 234 235 if (message.Length != 0) { 236 ErrorHandling.ShowErrorDialog(this, new InvalidOperationException(message.ToString())); 237 return false; 238 } 239 return true; 222 240 } 223 241 #endregion -
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/RegressionSolutionView.cs
r10173 r10174 20 20 #endregion 21 21 22 using System; 22 23 using System.Windows.Forms; 23 24 using HeuristicLab.Core; 24 25 using HeuristicLab.MainForm; 26 using HeuristicLab.PluginInfrastructure; 25 27 26 28 namespace HeuristicLab.Problems.DataAnalysis.Views { … … 51 53 } 52 54 #endregion 55 56 protected override bool CheckCompatibilityOfProblemData(IDataAnalysisProblemData problemData) { 57 IRegressionProblemData regressionProblemData = (IRegressionProblemData)problemData; 58 59 if (!regressionProblemData.TargetVariable.Equals(Content.ProblemData.TargetVariable)) { 60 string message = "The target variables are not matching. Old target variable: '" 61 + Content.ProblemData.TargetVariable 62 + "'. New targetvariable: '" + regressionProblemData.TargetVariable + "'"; 63 ErrorHandling.ShowErrorDialog(this, new InvalidOperationException(message)); 64 return false; 65 } 66 67 return base.CheckCompatibilityOfProblemData(problemData); 68 } 53 69 } 54 70 }
Note: See TracChangeset
for help on using the changeset viewer.