Free cookie consent management tool by TermsFeed Policy Generator

Changeset 8719 for trunk


Ignore:
Timestamp:
10/02/12 13:46:27 (12 years ago)
Author:
sforsten
Message:

#1963: if possible all solutions are added/removed at once, otherwise one solution is added/removed at a time

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Core/3.3/HeuristicLab.Core-3.3.csproj

    r8600 r8719  
    265265  -->
    266266  <PropertyGroup>
    267    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
     267    <PreBuildEvent Condition=" '$(OS)' == 'Windows_NT' ">set Path=%25Path%25;$(ProjectDir);$(SolutionDir)
    268268set ProjectDir=$(ProjectDir)
    269269set SolutionDir=$(SolutionDir)
     
    272272call PreBuildEvent.cmd
    273273</PreBuildEvent>
    274 <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
     274    <PreBuildEvent Condition=" '$(OS)' != 'Windows_NT' ">
    275275export ProjectDir=$(ProjectDir)
    276276export SolutionDir=$(SolutionDir)
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationEnsembleSolutionModelView.cs

    r7259 r8719  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2527using HeuristicLab.Core.Views;
    2628using HeuristicLab.MainForm;
     
    8385            solutions = solutions.Select(s => cloner.Clone(s));
    8486          }
    85           foreach (var solution in solutions)
    86             Content.Add(solution);
     87          var solutionCollection = Content as ItemCollection<IClassificationSolution>;
     88          if (solutionCollection != null) {
     89            solutionCollection.AddRange(solutions);
     90          } else {
     91            foreach (var solution in solutions)
     92              Content.Add(solution);
     93          }
     94        }
     95      }
     96      protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     97        var solutionCollection = Content as ItemCollection<IClassificationSolution>;
     98        if (e.KeyCode == Keys.Delete && solutionCollection != null) {
     99          if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
     100            solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IClassificationSolution)x.Tag));
     101          }
     102        } else {
     103          base.itemsListView_KeyDown(sender, e);
     104        }
     105      }
     106      protected override void removeButton_Click(object sender, EventArgs e) {
     107        var solutionCollection = Content as ItemCollection<IClassificationSolution>;
     108        if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
     109          solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IClassificationSolution)x.Tag));
     110          itemsListView.SelectedItems.Clear();
     111        } else {
     112          base.removeButton_Click(sender, e);
    87113        }
    88114      }
  • trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.cs

    r7259 r8719  
    2020#endregion
    2121
     22using System;
    2223using System.Linq;
    2324using System.Windows.Forms;
    2425using HeuristicLab.Common;
     26using HeuristicLab.Core;
    2527using HeuristicLab.Core.Views;
    2628using HeuristicLab.MainForm;
     
    8385            solutions = solutions.Select(s => cloner.Clone(s));
    8486          }
    85           foreach (var solution in solutions)
    86             Content.Add(solution);
     87          var solutionCollection = Content as ItemCollection<IRegressionSolution>;
     88          if (solutionCollection != null) {
     89            solutionCollection.AddRange(solutions);
     90          } else {
     91            foreach (var solution in solutions)
     92              Content.Add(solution);
     93          }
     94        }
     95      }
     96      protected override void itemsListView_KeyDown(object sender, KeyEventArgs e) {
     97        var solutionCollection = Content as ItemCollection<IRegressionSolution>;
     98        if (e.KeyCode == Keys.Delete && solutionCollection != null) {
     99          if ((itemsListView.SelectedItems.Count > 0) && !Content.IsReadOnly && !ReadOnly) {
     100            solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionSolution)x.Tag));
     101          }
     102        } else {
     103          base.itemsListView_KeyDown(sender, e);
     104        }
     105      }
     106      protected override void removeButton_Click(object sender, EventArgs e) {
     107        var solutionCollection = Content as ItemCollection<IRegressionSolution>;
     108        if (itemsListView.SelectedItems.Count > 0 && solutionCollection != null) {
     109          solutionCollection.RemoveRange(itemsListView.SelectedItems.Cast<ListViewItem>().Select(x => (IRegressionSolution)x.Tag));
     110          itemsListView.SelectedItems.Clear();
     111        } else {
     112          base.removeButton_Click(sender, e);
    87113        }
    88114      }
Note: See TracChangeset for help on using the changeset viewer.