Line | |
---|
1 | using System;
|
---|
2 | using System.Collections.Generic;
|
---|
3 | using System.Windows;
|
---|
4 | using Microsoft.Research.DynamicDataDisplay.Charts;
|
---|
5 |
|
---|
6 | namespace Microsoft.Research.DynamicDataDisplay.DataSources
|
---|
7 | {
|
---|
8 | public static class DataSourceHelper
|
---|
9 | {
|
---|
10 | public static IEnumerable<Point> GetPoints(IPointDataSource dataSource)
|
---|
11 | {
|
---|
12 | return GetPoints(dataSource, null);
|
---|
13 | }
|
---|
14 |
|
---|
15 | public static IEnumerable<Point> GetPoints(IPointDataSource dataSource, DependencyObject context)
|
---|
16 | {
|
---|
17 | if (dataSource == null)
|
---|
18 | throw new ArgumentNullException("dataSource");
|
---|
19 |
|
---|
20 | if (context == null)
|
---|
21 | context = new DataSource2dContext();
|
---|
22 |
|
---|
23 | using (IPointEnumerator enumerator = dataSource.GetEnumerator(context))
|
---|
24 | {
|
---|
25 | Point p = new Point();
|
---|
26 | while (enumerator.MoveNext())
|
---|
27 | {
|
---|
28 | enumerator.GetCurrent(ref p);
|
---|
29 | yield return p;
|
---|
30 | p = new Point();
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
34 | }
|
---|
35 | }
|
---|
Note: See
TracBrowser
for help on using the repository browser.