Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.MetaOptimization (trunk integration)/HeuristicLab.Problems.MetaOptimization.Views/3.3/RunCollectionItemDictionaryView.cs @ 8978

Last change on this file since 8978 was 8576, checked in by jkarder, 12 years ago

#1853: created branch for MetaOptimization (trunk integration)

File size: 1.9 KB
Line 
1using System.Collections.Generic;
2using System.Windows.Forms;
3using HeuristicLab.Core;
4using HeuristicLab.Core.Views;
5using HeuristicLab.Data;
6using HeuristicLab.MainForm;
7using HeuristicLab.Optimization;
8
9namespace 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}
Note: See TracBrowser for help on using the repository browser.