BodyFrameArrivedEventArgs.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using RootSystem = System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. namespace Windows.Kinect
  5. {
  6. //
  7. // Windows.Kinect.BodyFrameArrivedEventArgs
  8. //
  9. public sealed partial class BodyFrameArrivedEventArgs : 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 BodyFrameArrivedEventArgs(RootSystem.IntPtr pNative)
  15. {
  16. _pNative = pNative;
  17. Windows_Kinect_BodyFrameArrivedEventArgs_AddRefObject(ref _pNative);
  18. }
  19. ~BodyFrameArrivedEventArgs()
  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_BodyFrameArrivedEventArgs_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_BodyFrameArrivedEventArgs_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<BodyFrameArrivedEventArgs>(_pNative);
  35. Windows_Kinect_BodyFrameArrivedEventArgs_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 RootSystem.IntPtr Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(RootSystem.IntPtr pNative);
  41. public Windows.Kinect.BodyFrameReference FrameReference
  42. {
  43. get
  44. {
  45. if (_pNative == RootSystem.IntPtr.Zero)
  46. {
  47. throw new RootSystem.ObjectDisposedException("BodyFrameArrivedEventArgs");
  48. }
  49. RootSystem.IntPtr objectPointer = Windows_Kinect_BodyFrameArrivedEventArgs_get_FrameReference(_pNative);
  50. Helper.ExceptionHelper.CheckLastError();
  51. if (objectPointer == RootSystem.IntPtr.Zero)
  52. {
  53. return null;
  54. }
  55. return Helper.NativeObjectCache.CreateOrGetObject<Windows.Kinect.BodyFrameReference>(objectPointer, n => new Windows.Kinect.BodyFrameReference(n));
  56. }
  57. }
  58. private void __EventCleanup()
  59. {
  60. }
  61. }
  62. }