using System.Collections.Generic; using System.Windows.Forms; using HeuristicLab.Core; using HeuristicLab.Core.Views; using HeuristicLab.Data; using HeuristicLab.MainForm; using HeuristicLab.Optimization; namespace HeuristicLab.Problems.MetaOptimization.Views { [View("RunCollectionItemDictionaryView")] [Content(typeof(ItemDictionary), IsDefaultView = false)] public sealed partial class RunCollectionItemDictionaryView : ItemView { public new ItemDictionary Content { get { return (ItemDictionary)base.Content; } set { base.Content = value; } } public RunCollectionItemDictionaryView() { InitializeComponent(); } protected override void DeregisterContentEvents() { base.DeregisterContentEvents(); } protected override void RegisterContentEvents() { base.RegisterContentEvents(); } #region Event Handlers (Content) #endregion protected override void OnContentChanged() { base.OnContentChanged(); if (Content == null) { this.runCollectionDictionaryView.Content = null; this.runCollectionView.Content = null; } else { this.runCollectionDictionaryView.Content = Content; this.runCollectionView.Content = new RunCollection(GetAllRuns(Content)); // TODO: register for runs added/removed and dictionary-entries added/removed } } private IEnumerable GetAllRuns(ItemDictionary runsDictionary) { var runs = new List(); foreach (var item in runsDictionary) { runs.AddRange(item.Value); } return runs; } protected override void SetEnabledStateOfControls() { base.SetEnabledStateOfControls(); } #region Event Handlers (child controls) #endregion } }