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/ItemCollectionView.cs

    r5744 r5837  
    253253        if (items.Count > 0) {
    254254          DataObject data = new DataObject();
    255           if (items.Count == 1) data.SetData("HeuristicLab", items[0]);
    256           else data.SetData("HeuristicLab", items);
     255          if (items.Count == 1) data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items[0]);
     256          else data.SetData(HeuristicLab.Common.Constants.DragDropDataFormat, items);
    257257          if (Content.IsReadOnly || ReadOnly) {
    258258            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    268268    protected virtual void itemsListView_DragEnter(object sender, DragEventArgs e) {
    269269      validDragOperation = false;
    270       if (e.Data.GetData("HeuristicLab") is T) {
     270      if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T)) {
    271271        validDragOperation = true;
    272       } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
     272      } else if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable)) {
    273273        validDragOperation = true;
    274         IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     274        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    275275        foreach (object item in items)
    276276          validDragOperation = validDragOperation && (item is T);
    277277      }
    278       validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;
    279278    }
    280279    protected virtual void itemsListView_DragOver(object sender, DragEventArgs e) {
     
    290289    protected virtual void itemsListView_DragDrop(object sender, DragEventArgs e) {
    291290      if (e.Effect != DragDropEffects.None) {
    292         if (e.Data.GetData("HeuristicLab") is T) {
    293           T item = (T)e.Data.GetData("HeuristicLab");
     291        if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is T) {
     292          T item = (T)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    294293          Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
    295         } else if (e.Data.GetData("HeuristicLab") is IEnumerable) {
    296           IEnumerable<T> items = ((IEnumerable)e.Data.GetData("HeuristicLab")).Cast<T>();
     294        } else if (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IEnumerable) {
     295          IEnumerable<T> items = ((IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat)).Cast<T>();
    297296          foreach (T item in items)
    298297            Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (T)item.Clone() : item);
Note: See TracChangeset for help on using the changeset viewer.