Free cookie consent management tool by TermsFeed Policy Generator

source: branches/HeuristicLab.Problems.GrammaticalOptimization/DynamicDataDisplay/DataSources/OneDimensional/TableDataSource.cs @ 13467

Last change on this file since 13467 was 12503, checked in by aballeit, 9 years ago

#2283 added GUI and charts; fixed MCTS

File size: 957 bytes
Line 
1using System.Data;
2using System.Linq;
3using System.Windows;
4using System.Collections.Generic;
5
6namespace Microsoft.Research.DynamicDataDisplay.DataSources
7{
8  /// <summary>Data source that extracts sequence of points and their attributes from DataTable</summary>
9  public class TableDataSource : EnumerableDataSource<DataRow>
10  {
11    public TableDataSource(DataTable table)
12      : base(table.Rows)
13    {
14      // Subscribe to DataTable events
15      table.TableNewRow += NewRowInsertedHandler;
16      table.RowChanged += RowChangedHandler;
17      table.RowDeleted += RowChangedHandler;
18    }
19
20    private void RowChangedHandler(object sender, DataRowChangeEventArgs e)
21    {
22      RaiseDataChanged();
23    }
24
25    private void NewRowInsertedHandler(object sender, DataTableNewRowEventArgs e)
26    {
27      // Raise DataChanged event. ChartPlotter should redraw graph.
28      // This will be done automatically when rows are added to table.
29      RaiseDataChanged();
30    }
31  }
32}
Note: See TracBrowser for help on using the repository browser.