Changeset 11202 for branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
- Timestamp:
- 07/18/14 12:01:13 (10 years ago)
- Location:
- branches/HiveStatistics/sources
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/HiveStatistics/sources
- Property svn:ignore
-
old new 8 8 FxCopResults.txt 9 9 Google.ProtocolBuffers-0.9.1.dll 10 Google.ProtocolBuffers-2.4.1.473.dll 10 11 HeuristicLab 3.3.5.1.ReSharper.user 11 12 HeuristicLab 3.3.6.0.ReSharper.user 12 13 HeuristicLab.4.5.resharper.user 13 14 HeuristicLab.ExtLibs.6.0.ReSharper.user 15 HeuristicLab.Scripting.Development 14 16 HeuristicLab.resharper.user 15 17 ProtoGen.exe … … 17 19 _ReSharper.HeuristicLab 18 20 _ReSharper.HeuristicLab 3.3 21 _ReSharper.HeuristicLab 3.3 Tests 19 22 _ReSharper.HeuristicLab.ExtLibs 20 23 bin 21 24 protoc.exe 22 _ReSharper.HeuristicLab 3.3 Tests23 Google.ProtocolBuffers-2.4.1.473.dll
-
- Property svn:mergeinfo changed
- Property svn:ignore
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Views
- Property svn:mergeinfo changed
-
branches/HiveStatistics/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Solution Views/DataAnalysisSolutionView.cs
r8798 r11202 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2014 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 30 30 using HeuristicLab.Optimization; 31 31 using HeuristicLab.Optimization.Views; 32 using HeuristicLab.Persistence.Default.Xml; 33 using HeuristicLab.PluginInfrastructure; 32 34 33 35 namespace HeuristicLab.Problems.DataAnalysis.Views { 36 34 37 [View("DataAnalysisSolution View")] 35 38 [Content(typeof(DataAnalysisSolution), false)] … … 49 52 addButton.Enabled = false; 50 53 removeButton.Enabled = false; 54 loadProblemDataButton.Enabled = Content != null && !Locked; 51 55 } 52 56 … … 119 123 } 120 124 125 protected virtual void loadProblemDataButton_Click(object sender, EventArgs e) { 126 if (loadProblemDataFileDialog.ShowDialog(this) != DialogResult.OK) return; 127 try { 128 object hlFile = XmlParser.Deserialize(loadProblemDataFileDialog.FileName); 129 130 IDataAnalysisProblemData problemData = null; 131 if (hlFile is IDataAnalysisProblemData) { 132 problemData = (IDataAnalysisProblemData)hlFile; 133 } else if (hlFile is IDataAnalysisProblem) { 134 problemData = ((IDataAnalysisProblem)hlFile).ProblemData; 135 } else if (hlFile is IDataAnalysisSolution) { 136 problemData = ((IDataAnalysisSolution)hlFile).ProblemData; 137 } 138 139 if (problemData == null) 140 throw new InvalidOperationException("The chosen HeuristicLab file does not contain a ProblemData, Problem, or DataAnalysisSolution."); 141 142 var solution = (IDataAnalysisSolution)Content.Clone(); 143 problemData.AdjustProblemDataProperties(solution.ProblemData); 144 solution.ProblemData = problemData; 145 if (!solution.Name.EndsWith(" with loaded problemData")) 146 solution.Name += " with loaded problemData"; 147 MainFormManager.MainForm.ShowContent(solution); 148 } 149 catch (InvalidOperationException invalidOperationException) { 150 ErrorHandling.ShowErrorDialog(this, invalidOperationException); 151 } 152 catch (ArgumentException argumentException) { 153 ErrorHandling.ShowErrorDialog(this, argumentException); 154 } 155 } 156 121 157 protected void AddViewListViewItem(Type viewType, Image image) { 122 158 ListViewItem listViewItem = new ListViewItem(); … … 165 201 validDragOperation = false; 166 202 if (ReadOnly) return; 203 if (e.Effect != DragDropEffects.Copy) return; 167 204 168 205 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 169 if (dropData is DataAnalysisProblemData) validDragOperation = true; 206 if (dropData is IDataAnalysisProblemData) validDragOperation = true; 207 else if (dropData is IDataAnalysisProblem) validDragOperation = true; 170 208 else if (dropData is IValueParameter) { 171 209 var param = (IValueParameter)dropData; 172 if (param.Value is DataAnalysisProblemData) validDragOperation = true;210 if (param.Value is IDataAnalysisProblemData) validDragOperation = true; 173 211 } 174 212 } 175 213 176 214 protected override void itemsListView_DragDrop(object sender, DragEventArgs e) { 177 if (e.Effect != DragDropEffects.None) { 178 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 179 if (dropData is DataAnalysisProblemData) { 180 DataAnalysisProblemData problemData = (DataAnalysisProblemData)dropData; 181 Content.ProblemData = (DataAnalysisProblemData)problemData.Clone(); 182 } else if (dropData is IValueParameter) { 183 var param = (IValueParameter)dropData; 184 DataAnalysisProblemData problemData = param.Value as DataAnalysisProblemData; 185 if (problemData != null) 186 Content.ProblemData = (DataAnalysisProblemData)problemData.Clone(); 187 } 215 if (e.Effect == DragDropEffects.None) return; 216 217 IDataAnalysisProblemData problemData = null; 218 var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 219 if (dropData is IDataAnalysisProblemData) 220 problemData = (IDataAnalysisProblemData)dropData; 221 else if (dropData is IDataAnalysisProblem) 222 problemData = ((IDataAnalysisProblem)dropData).ProblemData; 223 else if (dropData is IValueParameter) { 224 var param = (IValueParameter)dropData; 225 problemData = param.Value as DataAnalysisProblemData; 226 } 227 if (problemData == null) return; 228 229 try { 230 problemData.AdjustProblemDataProperties(Content.ProblemData); 231 Content.ProblemData = problemData; 232 233 if (!Content.Name.EndsWith(" with changed problemData")) 234 Content.Name += " with changed problemData"; 235 } 236 catch (InvalidOperationException invalidOperationException) { 237 ErrorHandling.ShowErrorDialog(this, invalidOperationException); 238 } 239 catch (ArgumentException argumentException) { 240 ErrorHandling.ShowErrorDialog(this, argumentException); 188 241 } 189 242 } 190 243 #endregion 244 191 245 } 192 246 }
Note: See TracChangeset
for help on using the changeset viewer.