[8576] | 1 | using System.Collections.Generic;
|
---|
| 2 | using System.Windows.Forms;
|
---|
| 3 | using HeuristicLab.Core;
|
---|
| 4 | using HeuristicLab.Core.Views;
|
---|
| 5 | using HeuristicLab.Data;
|
---|
| 6 | using HeuristicLab.MainForm;
|
---|
| 7 | using HeuristicLab.Optimization;
|
---|
| 8 |
|
---|
| 9 | namespace HeuristicLab.Problems.MetaOptimization.Views {
|
---|
| 10 |
|
---|
| 11 | [View("RunCollectionItemDictionaryView")]
|
---|
| 12 | [Content(typeof(ItemDictionary<StringValue, RunCollection>), IsDefaultView = false)]
|
---|
| 13 | public sealed partial class RunCollectionItemDictionaryView : ItemView {
|
---|
| 14 | public new ItemDictionary<StringValue, RunCollection> Content {
|
---|
| 15 | get { return (ItemDictionary<StringValue, RunCollection>)base.Content; }
|
---|
| 16 | set { base.Content = value; }
|
---|
| 17 | }
|
---|
| 18 |
|
---|
| 19 | public RunCollectionItemDictionaryView() {
|
---|
| 20 | InitializeComponent();
|
---|
| 21 | }
|
---|
| 22 |
|
---|
| 23 | protected override void DeregisterContentEvents() {
|
---|
| 24 | base.DeregisterContentEvents();
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | protected override void RegisterContentEvents() {
|
---|
| 28 | base.RegisterContentEvents();
|
---|
| 29 | }
|
---|
| 30 |
|
---|
| 31 | #region Event Handlers (Content)
|
---|
| 32 | #endregion
|
---|
| 33 |
|
---|
| 34 | protected override void OnContentChanged() {
|
---|
| 35 | base.OnContentChanged();
|
---|
| 36 | if (Content == null) {
|
---|
| 37 | this.runCollectionDictionaryView.Content = null;
|
---|
| 38 | this.runCollectionView.Content = null;
|
---|
| 39 | } else {
|
---|
| 40 | this.runCollectionDictionaryView.Content = Content;
|
---|
| 41 | this.runCollectionView.Content = new RunCollection(GetAllRuns(Content));
|
---|
| 42 | // TODO: register for runs added/removed and dictionary-entries added/removed
|
---|
| 43 | }
|
---|
| 44 | }
|
---|
| 45 |
|
---|
| 46 | private IEnumerable<IRun> GetAllRuns(ItemDictionary<StringValue, RunCollection> runsDictionary) {
|
---|
| 47 | var runs = new List<IRun>();
|
---|
| 48 | foreach (var item in runsDictionary) {
|
---|
| 49 | runs.AddRange(item.Value);
|
---|
| 50 | }
|
---|
| 51 | return runs;
|
---|
| 52 | }
|
---|
| 53 |
|
---|
| 54 |
|
---|
| 55 | protected override void SetEnabledStateOfControls() {
|
---|
| 56 | base.SetEnabledStateOfControls();
|
---|
| 57 | }
|
---|
| 58 |
|
---|
| 59 | #region Event Handlers (child controls)
|
---|
| 60 | #endregion
|
---|
| 61 | }
|
---|
| 62 | }
|
---|