Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/23/11 11:15:34 (13 years ago)
Author:
mkommend
Message:

#1418: Fixed drag and drop on CrossValidationView.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Algorithms.DataAnalysis.Views/3.4/CrossValidationView.cs

    r5809 r5813  
    317317    private void algorithmTabPage_DragEnterOver(object sender, DragEventArgs e) {
    318318      e.Effect = DragDropEffects.None;
     319      IAlgorithm algorithm = e.Data.GetData("HeuristicLab") as IAlgorithm;
     320      if (!ReadOnly && algorithm != null &&
     321        (algorithm.ProblemType != null || Content.ProblemType.IsAssignableFrom(algorithm.Problem.GetType())) ){
     322        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
     323        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     324        else if (e.AllowedEffect.HasFlag(DragDropEffects.Copy)) e.Effect = DragDropEffects.Copy;
     325        else if (e.AllowedEffect.HasFlag(DragDropEffects.Move)) e.Effect = DragDropEffects.Move;
     326        else if (e.AllowedEffect.HasFlag(DragDropEffects.Link)) e.Effect = DragDropEffects.Link;
     327      }
     328    }
     329    private void algorithmTabPage_DragDrop(object sender, DragEventArgs e) {
     330      if (e.Effect != DragDropEffects.None) {
     331        IAlgorithm algorithm = e.Data.GetData("HeuristicLab") as IAlgorithm;
     332        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) algorithm = (IAlgorithm)algorithm.Clone();
     333        Content.Algorithm = algorithm;
     334      }
     335    }
     336
     337    private void algorithmProblemTabPage_DragEnterOver(object sender, DragEventArgs e) {
     338      e.Effect = DragDropEffects.None;
    319339      if (ReadOnly) return;
    320       Type type = e.Data.GetData("Type") as Type;
    321       IAlgorithm algorithm = e.Data.GetData("Value") as IAlgorithm;
    322       if ((type != null) && (typeof(IAlgorithm).IsAssignableFrom(type)) &&
    323         algorithm != null && Content.ProblemType.IsAssignableFrom(algorithm.Problem.GetType())) {
     340      IProblem problem = e.Data.GetData("HeuristicLab") as IProblem;
     341      if (problem != null && Content.ProblemType.IsAssignableFrom(problem.GetType()) &&
     342        Content.Algorithm.ProblemType.IsAssignableFrom(problem.GetType())) {
    324343        if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    325344        else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
     
    329348      }
    330349    }
    331     private void algorithmTabPage_DragDrop(object sender, DragEventArgs e) {
    332       if (e.Effect != DragDropEffects.None) {
    333         IAlgorithm algorithm = e.Data.GetData("Value") as IAlgorithm;
    334         if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) algorithm = (IAlgorithm)algorithm.Clone();
    335         Content.Algorithm = algorithm;
    336       }
    337     }
    338 
    339     private void algorithmProblemTabPage_DragEnterOver(object sender, DragEventArgs e) {
    340       e.Effect = DragDropEffects.None;
    341       if (ReadOnly) return;
    342       Type type = e.Data.GetData("Type") as Type;
    343       if ((type != null) && (Content.ProblemType.IsAssignableFrom(type)) &&
    344         (Content.Algorithm.ProblemType.IsAssignableFrom(type))) {
    345         if ((e.KeyState & 32) == 32) e.Effect = DragDropEffects.Link;  // ALT key
    346         else if ((e.KeyState & 4) == 4) e.Effect = DragDropEffects.Move;  // SHIFT key
    347         else if ((e.AllowedEffect & DragDropEffects.Copy) == DragDropEffects.Copy) e.Effect = DragDropEffects.Copy;
    348         else if ((e.AllowedEffect & DragDropEffects.Move) == DragDropEffects.Move) e.Effect = DragDropEffects.Move;
    349         else if ((e.AllowedEffect & DragDropEffects.Link) == DragDropEffects.Link) e.Effect = DragDropEffects.Link;
    350       }
    351     }
    352350    private void algorithmProblemTabPage_DragDrop(object sender, DragEventArgs e) {
    353351      if (e.Effect != DragDropEffects.None) {
    354         IDataAnalysisProblem<IDataAnalysisProblemData> problem = e.Data.GetData("Value") as IDataAnalysisProblem<IDataAnalysisProblemData>;
    355         if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) problem = (IDataAnalysisProblem<IDataAnalysisProblemData>)problem.Clone();
     352        IDataAnalysisProblem problem = e.Data.GetData("HeuristicLab") as IDataAnalysisProblem;
     353        if ((e.Effect & DragDropEffects.Copy) == DragDropEffects.Copy) problem = (IDataAnalysisProblem)problem.Clone();
    356354        Content.Problem = problem;
    357355      }
Note: See TracChangeset for help on using the changeset viewer.