Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
08/17/11 14:37:34 (13 years ago)
Author:
mkommend
Message:

#1592: Enabled creation of empty ensemble solutions and problem data changes.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.cs

    r6642 r6666  
    1919 */
    2020#endregion
     21
     22using System.Linq;
    2123using System.Windows.Forms;
     24using HeuristicLab.Common;
    2225using HeuristicLab.Core.Views;
    2326using HeuristicLab.MainForm;
     
    4447    protected override void OnContentChanged() {
    4548      base.OnContentChanged();
    46       if (Content != null)
     49      if (Content != null) {
     50        view.Locked = Content.ProblemData == ClassificationEnsembleProblemData.EmptyProblemData;
    4751        view.Content = Content.ClassificationSolutions;
    48       else
     52      } else
    4953        view.Content = null;
    5054    }
     
    6266        detailsGroupBox.Enabled = Content != null && itemsListView.SelectedItems.Count == 1;
    6367      }
     68
     69      protected override void itemsListView_DragEnter(object sender, DragEventArgs e) {
     70        validDragOperation = false;
     71        if (ReadOnly || Locked) return;
     72        if (Content.IsReadOnly) return;
     73
     74        var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     75        validDragOperation = dropData.GetObjectGraphObjects().OfType<IClassificationSolution>().Any();
     76      }
     77      protected override void itemsListView_DragDrop(object sender, DragEventArgs e) {
     78        if (e.Effect != DragDropEffects.None) {
     79          var dropData = e.Data.GetData(HeuristicLab.Common.Constants.DragDropDataFormat);
     80          var solutions = dropData.GetObjectGraphObjects().OfType<IClassificationSolution>();
     81          if (e.Effect.HasFlag(DragDropEffects.Copy)) {
     82            Cloner cloner = new Cloner();
     83            solutions = solutions.Select(s => cloner.Clone(s));
     84          }
     85          foreach (var solution in solutions)
     86            Content.Add(solution);
     87        }
     88      }
    6489    }
    6590  }
Note: See TracChangeset for help on using the changeset viewer.