Changeset 5837 for trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs
- Timestamp:
- 03/28/11 14:53:01 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs
r5744 r5837 275 275 if (items.Count > 0) { 276 276 DataObject data = new DataObject(); 277 if (items.Count == 1) data.SetData( "HeuristicLab", items[0]);278 else data.SetData( "HeuristicLab", items);277 if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]); 278 else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items); 279 279 if (ReadOnly) { 280 280 DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link); … … 291 291 validDragOperation = false; 292 292 draggedItemsAlreadyContained = false; 293 if ( e.Data.GetData("HeuristicLab") is T) {293 if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) { 294 294 validDragOperation = true; 295 draggedItemsAlreadyContained = itemListViewItemMapping.ContainsKey((T)e.Data.GetData( "HeuristicLab"));296 } else if ( e.Data.GetData("HeuristicLab") is IEnumerable) {295 draggedItemsAlreadyContained = itemListViewItemMapping.ContainsKey((T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)); 296 } else if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) { 297 297 validDragOperation = true; 298 IEnumerable items = (IEnumerable)e.Data.GetData( "HeuristicLab");298 IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 299 299 foreach (object item in items) { 300 300 validDragOperation = validDragOperation && (item is T); … … 302 302 } 303 303 } 304 validDragOperation = validDragOperation && !ReadOnly;305 304 } 306 305 private void listView_DragOver(object sender, DragEventArgs e) { … … 317 316 if (e.Effect != DragDropEffects.None) { 318 317 try { 319 if (e.Data.GetData( "HeuristicLab") is T) {320 T item = (T)e.Data.GetData( "HeuristicLab");318 if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) { 319 T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat); 321 320 AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item); 322 } else if (e.Data.GetData( "HeuristicLab") is IEnumerable) {323 IEnumerable<T> items = ((IEnumerable)e.Data.GetData( "HeuristicLab")).Cast<T>();321 } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) { 322 IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>(); 324 323 foreach (T item in items) 325 324 AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
Note: See TracChangeset
for help on using the changeset viewer.