using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; using HeuristicLab.MainForm; using HeuristicLab.Core; using HeuristicLab.Optimization; using HeuristicLab.Data; using HeuristicLab.Core.Views; 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() { // TODO: Deregister your event handlers here base.DeregisterContentEvents(); } protected override void RegisterContentEvents() { base.RegisterContentEvents(); // TODO: Register your event handlers here } #region Event Handlers (Content) // TODO: Put event handlers of the content here #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(); // TODO: Enable or disable controls based on whether the content is null or the view is set readonly } #region Event Handlers (child controls) // TODO: Put event handlers of child controls here. #endregion } }