PageRenderTime 23ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

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