1 | using System.Collections.Generic;
|
---|
2 | using System.Windows.Forms;
|
---|
3 | using HeuristicLab.MainForm;
|
---|
4 | using HeuristicLab.Core;
|
---|
5 | using HeuristicLab.Optimization;
|
---|
6 | using HeuristicLab.Data;
|
---|
7 | using HeuristicLab.Core.Views;
|
---|
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 | // TODO: Deregister your event handlers here
|
---|
25 | base.DeregisterContentEvents();
|
---|
26 | }
|
---|
27 |
|
---|
28 | protected override void RegisterContentEvents() {
|
---|
29 | base.RegisterContentEvents();
|
---|
30 | // TODO: Register your event handlers here
|
---|
31 | }
|
---|
32 |
|
---|
33 | #region Event Handlers (Content)
|
---|
34 | // TODO: Put event handlers of the content here
|
---|
35 | #endregion
|
---|
36 |
|
---|
37 | protected override void OnContentChanged() {
|
---|
38 | base.OnContentChanged();
|
---|
39 | if (Content == null) {
|
---|
40 | this.runCollectionDictionaryView.Content = null;
|
---|
41 | this.runCollectionView.Content = null;
|
---|
42 | } else {
|
---|
43 | this.runCollectionDictionaryView.Content = Content;
|
---|
44 | this.runCollectionView.Content = new RunCollection(GetAllRuns(Content));
|
---|
45 | // todo: register for runs added/removed and dictionary-entries added/removed
|
---|
46 | }
|
---|
47 | }
|
---|
48 |
|
---|
49 | private IEnumerable<IRun> GetAllRuns(ItemDictionary<StringValue, RunCollection> runsDictionary) {
|
---|
50 | var runs = new List<IRun>();
|
---|
51 | foreach (var item in runsDictionary) {
|
---|
52 | runs.AddRange(item.Value);
|
---|
53 | }
|
---|
54 | return runs;
|
---|
55 | }
|
---|
56 |
|
---|
57 |
|
---|
58 | protected override void SetEnabledStateOfControls() {
|
---|
59 | base.SetEnabledStateOfControls();
|
---|
60 | // TODO: Enable or disable controls based on whether the content is null or the view is set readonly
|
---|
61 | }
|
---|
62 |
|
---|
63 | #region Event Handlers (child controls)
|
---|
64 | // TODO: Put event handlers of child controls here.
|
---|
65 | #endregion
|
---|
66 | }
|
---|
67 | }
|
---|