Changeset 10174 for trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
- Timestamp:
- 12/02/13 15:13:37 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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
Note: See TracChangeset
for help on using the changeset viewer.