private bool disposedValue = false; // To detect redundant calls

        /// <summary>
        /// Initializes a new instance of the <see cref="BodyFrame"/> class.
        /// </summary>
        /// <param name="handle"></param>
        internal BodyFrame(NativeMethods.k4abt_frame_t handle)
        {
            // Hook the native allocator and register this object.
            // .Dispose() will be called on this object when the allocator is shut down.
            Allocator.Singleton.RegisterForDisposal(this);

            this.handle = handle;
        }
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposedValue && disposing)
            {
                Allocator.Singleton.UnregisterForDisposal(this);

                this.handle.Close();
                this.handle = null;

                this.disposedValue = true;
            }
        }
Esempio n. 3
0
 internal Frame(NativeMethods.k4abt_frame_t frame)
 {
     this.handle = frame;
 }