Free cookie consent management tool by TermsFeed Policy Generator

source: branches/histogram/HeuristicLab.Problems.ExternalEvaluation.Views/3.3/EvaluationCacheView.cs @ 6244

Last change on this file since 6244 was 6195, checked in by abeham, 13 years ago

#1465

  • updated branch with latest version of trunk
File size: 2.1 KB
RevLine 
[6169]1using System;
2using System.Windows.Forms;
[6140]3using HeuristicLab.Core.Views;
4using HeuristicLab.MainForm;
5
[6169]6namespace HeuristicLab.Problems.ExternalEvaluation.Views {
7
[6140]8  [View("EvaluationCacheView")]
9  [Content(typeof(EvaluationCache), IsDefaultView = true)]
[6169]10  public sealed partial class EvaluationCacheView : ParameterizedNamedItemView {
[6140]11
12    public new EvaluationCache Content {
13      get { return (EvaluationCache)base.Content; }
14      set { base.Content = value; }
15    }
16
17    public EvaluationCacheView() {
18      InitializeComponent();
19    }
20
21    protected override void DeregisterContentEvents() {
[6169]22      Content.SizeChanged -= new System.EventHandler(Content_StatusChanged);
23      Content.HitsChanged -= new System.EventHandler(Content_StatusChanged);
[6183]24      Content.ActiveEvalutionsChanged -= new EventHandler(Content_StatusChanged);
[6140]25      base.DeregisterContentEvents();
26    }
27
28    protected override void RegisterContentEvents() {
29      base.RegisterContentEvents();
[6169]30      Content.SizeChanged += new System.EventHandler(Content_StatusChanged);
31      Content.HitsChanged += new System.EventHandler(Content_StatusChanged);
[6183]32      Content.ActiveEvalutionsChanged += new EventHandler(Content_StatusChanged);
[6140]33    }
34
35    #region Event Handlers (Content)
[6169]36    void Content_StatusChanged(object sender, EventArgs e) {
37      if (InvokeRequired)
38        Invoke(new EventHandler(Content_StatusChanged), sender, e);
39      else
[6183]40        hits_sizeTextBox.Text = string.Format("{0}/{1} ({2} active)", Content.Hits, Content.Size, Content.ActiveEvaluations);
[6140]41    }
42
43    #endregion
44
45    protected override void OnContentChanged() {
46      base.OnContentChanged();
47      if (Content == null) {
[6169]48        hits_sizeTextBox.Text = "#/#";
[6140]49      } else {
[6169]50        Content_StatusChanged(this, EventArgs.Empty);
[6140]51      }
52    }
53
54    protected override void SetEnabledStateOfControls() {
55      base.SetEnabledStateOfControls();
56      clearButton.Enabled = !ReadOnly && Content != null;
57    }
58
59    #region Event Handlers (child controls)
[6169]60    private void clearButton_Click(object sender, EventArgs e) {
[6140]61      Content.Reset();
62    }
63    #endregion
64  }
65}
Note: See TracBrowser for help on using the repository browser.