PropertyChangedEventArgs.cs 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. using RootSystem = System;
  2. using System.Linq;
  3. using System.Collections.Generic;
  4. namespace Windows.Data
  5. {
  6. //
  7. // Windows.Data.PropertyChangedEventArgs
  8. //
  9. public sealed partial class PropertyChangedEventArgs : 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 PropertyChangedEventArgs(RootSystem.IntPtr pNative)
  15. {
  16. _pNative = pNative;
  17. Windows_Data_PropertyChangedEventArgs_AddRefObject(ref _pNative);
  18. }
  19. ~PropertyChangedEventArgs()
  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_Data_PropertyChangedEventArgs_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_Data_PropertyChangedEventArgs_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<PropertyChangedEventArgs>(_pNative);
  35. Windows_Data_PropertyChangedEventArgs_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_Data_PropertyChangedEventArgs_get_PropertyName(RootSystem.IntPtr pNative);
  41. public string PropertyName
  42. {
  43. get
  44. {
  45. if (_pNative == RootSystem.IntPtr.Zero)
  46. {
  47. throw new RootSystem.ObjectDisposedException("PropertyChangedEventArgs");
  48. }
  49. RootSystem.IntPtr objectPointer = Windows_Data_PropertyChangedEventArgs_get_PropertyName(_pNative);
  50. Helper.ExceptionHelper.CheckLastError();
  51. var managedString = RootSystem.Runtime.InteropServices.Marshal.PtrToStringUni(objectPointer);
  52. RootSystem.Runtime.InteropServices.Marshal.FreeCoTaskMem(objectPointer);
  53. return managedString;
  54. }
  55. }
  56. private void __EventCleanup()
  57. {
  58. }
  59. }
  60. }