Free cookie consent management tool by TermsFeed Policy Generator

source: addons/HeuristicLab.MetaOptimization/HeuristicLab.Problems.MetaOptimization.Views/3.3/RunCollectionItemDictionaryView.cs @ 17282

Last change on this file since 17282 was 16996, checked in by gkronber, 6 years ago

#2520 Update plugin dependencies and references for HL.MetaOptimization for new persistence

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