コード例 #1
0
        public void Dispose()
        {
            if (connection != null)
            {
                connection.RemoveSubscription(this);
                connection = null;
            }

            if (subscriptionPtr == IntPtr.Zero)
            {
                return;
            }

            C.CheckOk(C.Instance.dxf_close_subscription(subscriptionPtr));
            subscriptionPtr = IntPtr.Zero;
        }
コード例 #2
0
        /// <summary>
        /// Dispose native snapshot subscription
        /// </summary>
        /// <exception cref="NativeDxSubscription"></exception>
        public void Dispose()
        {
            if (connection != null)
            {
                connection.RemoveSubscription(this);
                connection = null;
            }
            if (snapshotPtr == InvalidSnapshot)
            {
                return;
            }

            C.CheckOk(C.Instance.dxf_close_snapshot(snapshotPtr));
            snapshotPtr = InvalidSnapshot;

            eventType = EventType.None;
        }
コード例 #3
0
        private bool disposedValue = false; // To detect redundant calls

        /// <summary>
        ///   This code added to correctly implement the disposable pattern.
        /// </summary>
        protected virtual void Dispose(bool disposing)
        {
            if (connection != null)
            {
                connection.RemoveSubscription(this);
                connection = null;
            }

            if (disposedValue)
            {
                return;
            }

            if (disposing)
            {
                if (subscription != null)
                {
                    subscription.Dispose();
                    subscription = null;
                }
            }

            disposedValue = true;
        }