init
This commit is contained in:
35
Backup/DataSources/OneDimensional/DataSourceHelper.cs
Normal file
35
Backup/DataSources/OneDimensional/DataSourceHelper.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Windows;
|
||||
using Microsoft.Research.DynamicDataDisplay.Charts;
|
||||
|
||||
namespace Microsoft.Research.DynamicDataDisplay.DataSources
|
||||
{
|
||||
public static class DataSourceHelper
|
||||
{
|
||||
public static IEnumerable<Point> GetPoints(IPointDataSource dataSource)
|
||||
{
|
||||
return GetPoints(dataSource, null);
|
||||
}
|
||||
|
||||
public static IEnumerable<Point> GetPoints(IPointDataSource dataSource, DependencyObject context)
|
||||
{
|
||||
if (dataSource == null)
|
||||
throw new ArgumentNullException("dataSource");
|
||||
|
||||
if (context == null)
|
||||
context = new DataSource2dContext();
|
||||
|
||||
using (IPointEnumerator enumerator = dataSource.GetEnumerator(context))
|
||||
{
|
||||
Point p = new Point();
|
||||
while (enumerator.MoveNext())
|
||||
{
|
||||
enumerator.GetCurrent(ref p);
|
||||
yield return p;
|
||||
p = new Point();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user