Changeset 5837 for trunk/sources/HeuristicLab.Optimization.Views/3.3
- Timestamp:
- 03/28/11 14:53:01 (14 years ago)
- Location:
- trunk/sources/HeuristicLab.Optimization.Views/3.3
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Optimization.Views/3.3/AlgorithmView.cs
r5809 r5837 278 278 protected virtual void problemTabPage_DragEnterOver(object sender, DragEventArgs e) { 279 279 e.Effect = DragDropEffects.None; 280 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") != null) && Content.ProblemType.IsAssignableFrom(e.Data.GetData("HeuristicLab").GetType())) {280 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) != null) && Content.ProblemType.IsAssignableFrom(e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat).GetType())) { 281 281 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 282 282 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 288 288 protected virtual void problemTabPage_DragDrop(object sender, DragEventArgs e) { 289 289 if (e.Effect != DragDropEffects.None) { 290 IProblem problem = e.Data.GetData( "HeuristicLab") as IProblem;290 IProblem problem = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IProblem; 291 291 if (e.Effect.HasFlag(DragDropEffects.Copy)) problem = (IProblem)problem.Clone(); 292 292 Content.Problem = problem; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs
r5744 r5837 253 253 private void optimizerTabPage_DragEnterOver(object sender, DragEventArgs e) { 254 254 e.Effect = DragDropEffects.None; 255 if (!ReadOnly && (e.Data.GetData( "HeuristicLab") is IOptimizer)) {255 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IOptimizer)) { 256 256 if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link; // ALT key 257 257 else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move; // SHIFT key … … 263 263 private void optimizerTabPage_DragDrop(object sender, DragEventArgs e) { 264 264 if (e.Effect != DragDropEffects.None) { 265 IOptimizer optimizer = e.Data.GetData( "HeuristicLab") as IOptimizer;265 IOptimizer optimizer = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) as IOptimizer; 266 266 if (e.Effect.HasFlag(DragDropEffects.Copy)) optimizer = (IOptimizer)optimizer.Clone(); 267 267 Content.Optimizer = optimizer; -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionBubbleChartView.cs
r5824 r5837 493 493 if (this.draggedRun != null && h.ChartElementType != ChartElementType.DataPoint) { 494 494 DataObject data = new DataObject(); 495 data.SetData( "HeuristicLab", draggedRun);495 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, draggedRun); 496 496 if (ReadOnly) 497 497 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunCollectionView.cs
r5744 r5837 273 273 if (items.Count > 0) { 274 274 DataObject data = new DataObject(); 275 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);276 else data.SetData( "HeuristicLab", items);275 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 276 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 277 277 if (Content.IsReadOnly || ReadOnly) { 278 278 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 288 288 private void itemsListView_DragEnter(object sender, DragEventArgs e) { 289 289 validDragOperation = false; 290 if ( e.Data.GetData("HeuristicLab") is IRun) {290 if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun)) { 291 291 validDragOperation = true; 292 } else if ( e.Data.GetData("HeuristicLab") is IEnumerable) {292 } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 293 293 validDragOperation = true; 294 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");294 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 295 295 foreach (object item in items) 296 296 validDragOperation = validDragOperation && (item is IRun); 297 297 } 298 validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;299 298 } 300 299 private void itemsListView_DragOver(object sender, DragEventArgs e) { … … 310 309 private void itemsListView_DragDrop(object sender, DragEventArgs e) { 311 310 if (e.Effect != DragDropEffects.None) { 312 if (e.Data.GetData( "HeuristicLab") is IRun) {313 IRun item = (IRun)e.Data.GetData( "HeuristicLab");311 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun) { 312 IRun item = (IRun)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 314 313 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item); 315 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {316 IEnumerable<IRun> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<IRun>();314 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 315 IEnumerable<IRun> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<IRun>(); 317 316 foreach (IRun item in items) 318 317 Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item); -
trunk/sources/HeuristicLab.Optimization.Views/3.3/RunView.cs
r5744 r5837 149 149 if (item != null) { 150 150 DataObject data = new DataObject(); 151 data.SetData( "HeuristicLab", item);151 data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, item); 152 152 DragDropEffects result = DoDragDrop(data, DragDropEffects.Copy); 153 153 }
Note: See TracChangeset
for help on using the changeset viewer.