Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/18/11 01:38:23 (14 years ago)
Author:
swagner
Message:

Implemented dragging of multiple items in all collection views and refactored drag & drop code (#1112)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Optimization.Views/3.3/BatchRunView.cs

    r5445 r5744  
    253253    private void optimizerTabPage_DragEnterOver(object sender, DragEventArgs e) {
    254254      e.Effect = DragDropEffects.None;
    255       if (ReadOnly)
    256         return;
    257       Type type = e.Data.GetData("Type") as Type;
    258       if ((type != null) && (typeof(IOptimizer).IsAssignableFrom(type))) {
     255      if (!ReadOnly && (e.Data.GetData("HeuristicLab") is IOptimizer)) {
    259256        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    260257        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
    261         else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy;
    262         else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move;
    263         else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link;
     258        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     259        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
     260        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
    264261      }
    265262    }
    266263    private void optimizerTabPage_DragDrop(object sender, DragEventArgs e) {
    267264      if (e.Effect != DragDropEffects.None) {
    268         IOptimizer optimizer = e.Data.GetData("Value") as IOptimizer;
    269         if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) optimizer = (IOptimizer)optimizer.Clone();
     265        IOptimizer optimizer = e.Data.GetData("HeuristicLab") as IOptimizer;
     266        if (e.Effect.HasFlag(DragDropEffects.Copy)) optimizer = (IOptimizer)optimizer.Clone();
    270267        Content.Optimizer = optimizer;
    271268      }
Note: See TracChangeset for help on using the changeset viewer.