- Timestamp:
- 10/02/12 13:46:27 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionEnsembleSolutionModelView.cs
r7259 r8719 20 20 #endregion 21 21 22 using System; 22 23 using System.Linq; 23 24 using System.Windows.Forms; 24 25 using HeuristicLab.Common; 26 using HeuristicLab.Core; 25 27 using HeuristicLab.Core.Views; 26 28 using HeuristicLab.MainForm; … … 83 85 solutions = solutions.Select(s => cloner.Clone(s)); 84 86 } 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); 87 113 } 88 114 }
Note: See TracChangeset
for help on using the changeset viewer.