Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/11/10 03:59:22 (14 years ago)
Author:
swagner
Message:

Enabled dragging and dropping of problems and algorithms in AlgorithmView and BatchRunView (#965).

File:
1 edited

Legend:

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

    r3274 r3299  
    235235      }
    236236    }
     237    private void algorithmPanel_DragEnterOver(object sender, DragEventArgs e) {
     238      e.Effect = DragDropEffects.None;
     239      Type type = e.Data.GetData("Type") as Type;
     240      if ((type != null) && (typeof(IAlgorithm).IsAssignableFrom(type))) {
     241        if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy;  // CTRL key
     242        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     243        else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link;
     244        else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy;
     245        else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move;
     246      }
     247    }
     248    private void algorithmPanel_DragDrop(object sender, DragEventArgs e) {
     249      if (e.Effect != DragDropEffects.None) {
     250        IAlgorithm algorithm = e.Data.GetData("Value") as IAlgorithm;
     251        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) algorithm = (IAlgorithm)algorithm.Clone();
     252        Content.Algorithm = algorithm;
     253      }
     254    }
    237255    #endregion
    238256
Note: See TracChangeset for help on using the changeset viewer.