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

    r3275 r3299  
    163163    #endregion
    164164
    165     #region Button events
     165    #region Control Events
    166166    protected virtual void newProblemButton_Click(object sender, EventArgs e) {
    167167      if (problemTypeSelectorDialog == null) {
     
    247247      }
    248248    }
     249    protected virtual void problemPanel_DragEnterOver(object sender, DragEventArgs e) {
     250      e.Effect = DragDropEffects.None;
     251      Type type = e.Data.GetData("Type") as Type;
     252      if ((type != null) && (Content.ProblemType.IsAssignableFrom(type))) {
     253        if ((e.KeyState & 8) == 8) e.Effect = DragDropEffects.Copy;  // CTRL key
     254        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     255        else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link;
     256        else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy;
     257        else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move;
     258      }
     259    }
     260    protected virtual void problemPanel_DragDrop(object sender, DragEventArgs e) {
     261      if (e.Effect != DragDropEffects.None) {
     262        IProblem problem = e.Data.GetData("Value") as IProblem;
     263        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) problem = (IProblem)problem.Clone();
     264        Content.Problem = problem;
     265      }
     266    }
    249267    #endregion
    250268
Note: See TracChangeset for help on using the changeset viewer.