Free cookie consent management tool by TermsFeed Policy Generator

Changeset 14519


Ignore:
Timestamp:
12/22/16 11:02:48 (8 years ago)
Author:
pfleck
Message:

#2713 Fixed an issue with ObjectDisposedExceptions by using a AsynchronousContentView as base class instead of a UserControl.

Location:
trunk/sources/HeuristicLab.Analysis.Views/3.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/DataTableControl.cs

    r14508 r14519  
    2727using System.Windows.Forms.DataVisualization.Charting;
    2828using HeuristicLab.Collections;
     29using HeuristicLab.MainForm.WindowsForms;
    2930
    3031namespace HeuristicLab.Analysis.Views {
    31   public partial class DataTableControl : UserControl {
     32  public partial class DataTableControl : AsynchronousContentView {
    3233    protected List<Series> invisibleSeries;
    3334    protected Dictionary<IObservableList<double>, DataRow> valuesRowsTable;
    3435
    35     private DataTable content;
    36     public DataTable Content {
    37       get { return content; }
    38       set {
    39         if (value == content) return;
    40         if (content != null) DeregisterContentEvents();
    41         content = value;
    42         if (content != null) RegisterContentEvents();
    43         OnContentChanged();
    44         SetEnabledStateOfControls();
    45       }
     36    public new DataTable Content {
     37      get { return (DataTable)base.Content; }
     38      set { base.Content = value; }
    4639    }
    4740
     
    5649
    5750    #region Event Handler Registration
    58     protected virtual void DeregisterContentEvents() {
     51    protected override void DeregisterContentEvents() {
    5952      foreach (DataRow row in Content.Rows)
    6053        DeregisterDataRowEvents(row);
     
    6558      Content.Rows.CollectionReset -= new CollectionItemsChangedEventHandler<DataRow>(Rows_CollectionReset);
    6659    }
    67     protected virtual void RegisterContentEvents() {
     60    protected override void RegisterContentEvents() {
    6861      Content.VisualPropertiesChanged += new EventHandler(Content_VisualPropertiesChanged);
    6962      Content.Rows.ItemsAdded += new CollectionItemsChangedEventHandler<DataRow>(Rows_ItemsAdded);
     
    9588    #endregion
    9689
    97     protected virtual void OnContentChanged() {
     90    protected override void OnContentChanged() {
    9891      invisibleSeries.Clear();
    9992      chart.Titles[0].Text = string.Empty;
     
    111104    }
    112105
    113     protected virtual void SetEnabledStateOfControls() {
     106    protected override void SetEnabledStateOfControls() {
    114107      chart.Enabled = Content != null;
    115108    }
  • trunk/sources/HeuristicLab.Analysis.Views/3.3/ScatterPlotControl.cs

    r14516 r14519  
    2929using HeuristicLab.Collections;
    3030using HeuristicLab.Common;
     31using HeuristicLab.MainForm.WindowsForms;
    3132
    3233namespace HeuristicLab.Analysis.Views {
    33   public partial class ScatterPlotControl : UserControl {
     34  public partial class ScatterPlotControl : AsynchronousContentView {
    3435    protected List<Series> invisibleSeries;
    3536    protected Dictionary<IObservableList<Point2D<double>>, ScatterPlotDataRow> pointsRowsTable;
     
    3738    private double xMin, xMax, yMin, yMax;
    3839
    39     private ScatterPlot content;
    40     public ScatterPlot Content {
    41       get { return content; }
    42       set {
    43         if (value == content) return;
    44         if (content != null) DeregisterContentEvents();
    45         content = value;
    46         if (content != null) RegisterContentEvents();
    47         OnContentChanged();
    48         SetEnabledStateOfControls();
    49       }
     40    public new ScatterPlot Content {
     41      get { return (ScatterPlot)base.Content; }
     42      set { base.Content = value; }
    5043    }
    5144
     
    6154
    6255    #region Event Handler Registration
    63     protected virtual void DeregisterContentEvents() {
     56    protected override void DeregisterContentEvents() {
    6457      foreach (ScatterPlotDataRow row in Content.Rows)
    6558        DeregisterScatterPlotDataRowEvents(row);
     
    7063      Content.Rows.CollectionReset -= new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_CollectionReset);
    7164    }
    72     protected virtual void RegisterContentEvents() {
     65    protected override void RegisterContentEvents() {
    7366      Content.VisualPropertiesChanged += new EventHandler(Content_VisualPropertiesChanged);
    7467      Content.Rows.ItemsAdded += new CollectionItemsChangedEventHandler<ScatterPlotDataRow>(Rows_ItemsAdded);
     
    9891    #endregion
    9992
    100     protected virtual void OnContentChanged() {
     93    protected override void OnContentChanged() {
    10194      invisibleSeries.Clear();
    10295      chart.Titles[0].Text = string.Empty;
     
    114107    }
    115108
    116     protected virtual void SetEnabledStateOfControls() {
     109    protected override void SetEnabledStateOfControls() {
    117110      chart.Enabled = Content != null;
    118111    }
Note: See TracChangeset for help on using the changeset viewer.