Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/28/11 14:53:01 (13 years ago)
Author:
swagner
Message:

Implemented review comments of mkommend (#1112)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core.Views/3.3/Clipboard.cs

    r5744 r5837  
    275275      if (items.Count > 0) {
    276276        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);
    279279        if (ReadOnly) {
    280280          DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    291291      validDragOperation = false;
    292292      draggedItemsAlreadyContained = false;
    293       if (e.Data.GetData("HeuristicLab") is T) {
     293      if (!ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) {
    294294        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)) {
    297297        validDragOperation = true;
    298         IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     298        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    299299        foreach (object item in items) {
    300300          validDragOperation = validDragOperation && (item is T);
     
    302302        }
    303303      }
    304       validDragOperation = validDragOperation && !ReadOnly;
    305304    }
    306305    private void listView_DragOver(object sender, DragEventArgs e) {
     
    317316      if (e.Effect != DragDropEffects.None) {
    318317        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);
    321320            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>();
    324323            foreach (T item in items)
    325324              AddItem(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
Note: See TracChangeset for help on using the changeset viewer.