/Main/src/DynamicDataDisplay/DataSources/OneDimensional/EmptyDataSource.cs
C# | 55 lines | 41 code | 9 blank | 5 comment | 2 complexity | 1cb51e083b9414f6d979bd7c4dd26915 MD5 | raw file
Possible License(s): CC-BY-SA-3.0
1using System; 2using System.Collections.Generic; 3using System.Linq; 4using System.Text; 5using System.Windows; 6using System.Diagnostics.CodeAnalysis; 7 8namespace Microsoft.Research.DynamicDataDisplay.DataSources 9{ 10 /// <summary> 11 /// Empty data source - for testing purposes, represents data source with 0 points inside. 12 /// </summary> 13 public class EmptyDataSource : IPointDataSource 14 { 15 #region IPointDataSource Members 16 17 public IPointEnumerator GetEnumerator(DependencyObject context) 18 { 19 return new EmptyPointEnumerator(); 20 } 21 22 [SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")] 23 private void RaiseDataChanged() 24 { 25 if (DataChanged != null) 26 { 27 DataChanged(this, EventArgs.Empty); 28 } 29 } 30 31 public event EventHandler DataChanged; 32 33 #endregion 34 35 private sealed class EmptyPointEnumerator : IPointEnumerator 36 { 37 public bool MoveNext() 38 { 39 return false; 40 } 41 42 public void GetCurrent(ref Point p) 43 { 44 // nothing to do 45 } 46 47 public void ApplyMappings(DependencyObject target) 48 { 49 // nothing to do 50 } 51 52 public void Dispose() { } 53 } 54 } 55}