MpegTsPortabilityFactory.cs 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. using System.Collections.Generic;
  2. using System.Collections.ObjectModel;
  3. using System.Diagnostics;
  4. using System.Windows.Threading;
  5. using MatrixIO.Collections;
  6. using MatrixIO.IO;
  7. namespace TsViewer
  8. {
  9. internal class MpegTsPortabilityFactory : PortabilityFactory
  10. {
  11. private readonly Dispatcher _dispatcher;
  12. public MpegTsPortabilityFactory(Dispatcher dispatcher)
  13. {
  14. _dispatcher = dispatcher;
  15. }
  16. #region List Creation
  17. public override IList<T> CreateList<T>()
  18. {
  19. return new DispatchingObservableList<T>();
  20. }
  21. public override IList<T> CreateList<T>(int capacity)
  22. {
  23. return new DispatchingObservableList<T>(capacity);
  24. }
  25. public override IList<T> CreateList<T>(IEnumerable<T> collection)
  26. {
  27. return new DispatchingObservableList<T>(collection);
  28. }
  29. #endregion
  30. public override void DispatchAction(System.Action action)
  31. {
  32. _dispatcher.BeginInvoke(DispatcherPriority.DataBind, action);
  33. }
  34. #region Tracing
  35. public override void TraceWriteLine(object value, string category = null)
  36. {
  37. Trace.WriteLine(value, category);
  38. }
  39. public override void TraceAssert(bool condition, string message = null)
  40. {
  41. Trace.Assert(condition, message);
  42. }
  43. public override int TraceIndentLevel
  44. {
  45. get
  46. {
  47. return Trace.IndentLevel;
  48. }
  49. set
  50. {
  51. Trace.IndentLevel = value;
  52. }
  53. }
  54. #endregion
  55. }
  56. }