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.Optimization.Views/3.3/RunCollectionView.cs

    r5744 r5837  
    273273        if (items.Count > 0) {
    274274          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);
    277277          if (Content.IsReadOnly || ReadOnly) {
    278278            DoDragDrop(data, DragDropEffects.Copy | DragDropEffects.Link);
     
    288288    private void itemsListView_DragEnter(object sender, DragEventArgs e) {
    289289      validDragOperation = false;
    290       if (e.Data.GetData("HeuristicLab") is IRun) {
     290      if (!Content.IsReadOnly && !ReadOnly && (e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat) is IRun)) {
    291291        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)) {
    293293        validDragOperation = true;
    294         IEnumerable items = (IEnumerable)e.Data.GetData("HeuristicLab");
     294        IEnumerable items = (IEnumerable)e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
    295295        foreach (object item in items)
    296296          validDragOperation = validDragOperation && (item is IRun);
    297297      }
    298       validDragOperation = validDragOperation && !Content.IsReadOnly && !ReadOnly;
    299298    }
    300299    private void itemsListView_DragOver(object sender, DragEventArgs e) {
     
    310309    private void itemsListView_DragDrop(object sender, DragEventArgs e) {
    311310      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);
    314313          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>();
    317316          foreach (IRun item in items)
    318317            Content.Add(e.Effect.HasFlag(DragDropEffects.Copy) ? (IRun)item.Clone() : item);
Note: See TracChangeset for help on using the changeset viewer.