PDFJS_Promise.cs 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. namespace Paroxe.PdfRenderer.WebGL
  3. {
  4. public class PDFJS_Promise<T> : IPDFJS_Promise
  5. {
  6. private string m_PromiseHandle;
  7. private bool m_HasResult;
  8. private bool m_HasSucceeded;
  9. private bool m_HasFinished;
  10. private bool m_HasReceivedJSResponse;
  11. private bool m_HasBeenCancelled;
  12. private string m_ObjectHandle;
  13. private T m_Result;
  14. private float m_Progress;
  15. public string PromiseHandle
  16. {
  17. get { return m_PromiseHandle; }
  18. }
  19. public T Result
  20. {
  21. get { return m_Result; }
  22. set { m_Result = value; }
  23. }
  24. public string JSObjectHandle
  25. {
  26. get { return m_ObjectHandle; }
  27. set
  28. {
  29. if (m_ObjectHandle != value)
  30. m_ObjectHandle = value;
  31. }
  32. }
  33. public bool HasSucceeded
  34. {
  35. get { return m_HasSucceeded; }
  36. set
  37. {
  38. if (m_HasSucceeded != value)
  39. m_HasSucceeded = value;
  40. }
  41. }
  42. public bool HasFinished
  43. {
  44. get { return m_HasFinished; }
  45. set
  46. {
  47. if (m_HasFinished != value)
  48. m_HasFinished = value;
  49. }
  50. }
  51. public bool HasReceivedJSResponse
  52. {
  53. get { return m_HasReceivedJSResponse; }
  54. set
  55. {
  56. if (m_HasReceivedJSResponse != value)
  57. m_HasReceivedJSResponse = value;
  58. }
  59. }
  60. public bool HasBeenCancelled
  61. {
  62. get { return m_HasBeenCancelled; }
  63. set { m_HasBeenCancelled = value; }
  64. }
  65. public float Progress
  66. {
  67. get { return m_Progress; }
  68. set { m_Progress = value; }
  69. }
  70. public PDFJS_Promise()
  71. {
  72. m_PromiseHandle = CreateGUID();
  73. }
  74. private string CreateGUID()
  75. {
  76. return "{" + Guid.NewGuid().ToString() + "}";
  77. }
  78. }
  79. }