FrameCapturedEventArgs.cs 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. using RootSystem = System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. namespace Windows.Kinect
  5. {
  6. //
  7. // Windows.Kinect.FrameCapturedEventArgs
  8. //
  9. public sealed partial class FrameCapturedEventArgs : RootSystem.EventArgs, Helper.INativeWrapper
  10. {
  11. internal RootSystem.IntPtr _pNative;
  12. RootSystem.IntPtr Helper.INativeWrapper.nativePtr { get { return _pNative; } }
  13. // Constructors and Finalizers
  14. internal FrameCapturedEventArgs(RootSystem.IntPtr pNative)
  15. {
  16. _pNative = pNative;
  17. Windows_Kinect_FrameCapturedEventArgs_AddRefObject(ref _pNative);
  18. }
  19. ~FrameCapturedEventArgs()
  20. {
  21. Dispose(false);
  22. }
  23. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  24. private static extern void Windows_Kinect_FrameCapturedEventArgs_ReleaseObject(ref RootSystem.IntPtr pNative);
  25. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  26. private static extern void Windows_Kinect_FrameCapturedEventArgs_AddRefObject(ref RootSystem.IntPtr pNative);
  27. private void Dispose(bool disposing)
  28. {
  29. if (_pNative == RootSystem.IntPtr.Zero)
  30. {
  31. return;
  32. }
  33. __EventCleanup();
  34. Helper.NativeObjectCache.RemoveObject<FrameCapturedEventArgs>(_pNative);
  35. Windows_Kinect_FrameCapturedEventArgs_ReleaseObject(ref _pNative);
  36. _pNative = RootSystem.IntPtr.Zero;
  37. }
  38. // Public Properties
  39. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  40. private static extern Windows.Kinect.FrameCapturedStatus Windows_Kinect_FrameCapturedEventArgs_get_FrameStatus(RootSystem.IntPtr pNative);
  41. public Windows.Kinect.FrameCapturedStatus FrameStatus
  42. {
  43. get
  44. {
  45. if (_pNative == RootSystem.IntPtr.Zero)
  46. {
  47. throw new RootSystem.ObjectDisposedException("FrameCapturedEventArgs");
  48. }
  49. return Windows_Kinect_FrameCapturedEventArgs_get_FrameStatus(_pNative);
  50. }
  51. }
  52. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  53. private static extern Windows.Kinect.FrameSourceTypes Windows_Kinect_FrameCapturedEventArgs_get_FrameType(RootSystem.IntPtr pNative);
  54. public Windows.Kinect.FrameSourceTypes FrameType
  55. {
  56. get
  57. {
  58. if (_pNative == RootSystem.IntPtr.Zero)
  59. {
  60. throw new RootSystem.ObjectDisposedException("FrameCapturedEventArgs");
  61. }
  62. return Windows_Kinect_FrameCapturedEventArgs_get_FrameType(_pNative);
  63. }
  64. }
  65. [RootSystem.Runtime.InteropServices.DllImport("KinectUnityAddin", CallingConvention=RootSystem.Runtime.InteropServices.CallingConvention.Cdecl, SetLastError=true)]
  66. private static extern long Windows_Kinect_FrameCapturedEventArgs_get_RelativeTime(RootSystem.IntPtr pNative);
  67. public RootSystem.TimeSpan RelativeTime
  68. {
  69. get
  70. {
  71. if (_pNative == RootSystem.IntPtr.Zero)
  72. {
  73. throw new RootSystem.ObjectDisposedException("FrameCapturedEventArgs");
  74. }
  75. return RootSystem.TimeSpan.FromMilliseconds(Windows_Kinect_FrameCapturedEventArgs_get_RelativeTime(_pNative));
  76. }
  77. }
  78. private void __EventCleanup()
  79. {
  80. }
  81. }
  82. }