/// <summary>
        /// Unregister from Tango callbacks.
        ///
        /// See TangoApplication.Register for more details.
        /// </summary>
        /// <param name="tangoObject">Object to stop getting Tango callbacks from.</param>
        public void Unregister(System.Object tangoObject)
        {
            ITangoEvent tangoEvent = tangoObject as ITangoEvent;

            if (tangoEvent != null)
            {
                UnregisterOnTangoEvent(tangoEvent.OnTangoEventAvailableEventHandler);
            }

            ITangoEventMultithreaded tangoEventMultithreaded = tangoObject as ITangoEventMultithreaded;

            if (tangoEventMultithreaded != null)
            {
                UnregisterOnTangoEventMultithreaded(tangoEventMultithreaded.OnTangoEventMultithreadedAvailableEventHandler);
            }

            if (m_enableMotionTracking)
            {
                ITangoPose poseHandler = tangoObject as ITangoPose;

                if (poseHandler != null)
                {
                    UnregisterOnTangoPoseEvent(poseHandler.OnTangoPoseAvailable);
                }
            }

            if (m_enableDepth)
            {
                ITangoDepth depthHandler = tangoObject as ITangoDepth;

                if (depthHandler != null)
                {
                    UnregisterOnTangoDepthEvent(depthHandler.OnTangoDepthAvailable);
                }
            }

            if (m_enableVideoOverlay)
            {
                if (m_useExperimentalVideoOverlay)
                {
                    IExperimentalTangoVideoOverlay videoOverlayHandler = tangoObject as IExperimentalTangoVideoOverlay;

                    if (videoOverlayHandler != null)
                    {
                        UnregisterOnExperimentalTangoVideoOverlay(videoOverlayHandler.OnExperimentalTangoImageAvailable);
                    }
                }
                else
                {
                    ITangoVideoOverlay videoOverlayHandler = tangoObject as ITangoVideoOverlay;

                    if (videoOverlayHandler != null)
                    {
                        UnregisterOnTangoVideoOverlay(videoOverlayHandler.OnTangoImageAvailableEventHandler);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Unregister the specified tangoObject.
        /// </summary>
        /// <param name="tangoObject">Tango object.</param>
        public void Unregister(System.Object tangoObject)
        {
            if (m_enableMotionTracking)
            {
                ITangoPose poseHandler = tangoObject as ITangoPose;

                if (poseHandler != null)
                {
                    UnregisterOnTangoPoseEvent(poseHandler.OnTangoPoseAvailable);
                }
            }

            if (m_enableDepth)
            {
                ITangoDepth depthHandler = tangoObject as ITangoDepth;

                if (depthHandler != null)
                {
                    UnregisterOnTangoDepthEvent(depthHandler.OnTangoDepthAvailable);
                }
            }

            if (m_enableVideoOverlay)
            {
                if (m_useExperimentalVideoOverlay)
                {
                    IExperimentalTangoVideoOverlay videoOverlayHandler = tangoObject as IExperimentalTangoVideoOverlay;

                    if (videoOverlayHandler != null)
                    {
                        UnregisterOnExperimentalTangoVideoOverlay(videoOverlayHandler.OnExperimentalTangoImageAvailable);
                    }
                }
                else
                {
                    ITangoVideoOverlay videoOverlayHandler = tangoObject as ITangoVideoOverlay;

                    if (videoOverlayHandler != null)
                    {
                        UnregisterOnTangoVideoOverlay(videoOverlayHandler.OnTangoImageAvailableEventHandler);
                    }
                }
            }

            if (m_enableUXLibrary)
            {
                ITangoUX tangoUX = tangoObject as ITangoUX;

                if (tangoUX != null)
                {
                    UxExceptionListener.GetInstance.UnregisterOnMovingTooFast(tangoUX.onMovingTooFastEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnMotionTrackingInvalid(tangoUX.onMotionTrackingInvalidEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnLyingOnSurface(tangoUX.onLyingOnSurfaceEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnCameraOverExposed(tangoUX.onCameraOverExposedEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnCamerUnderExposed(tangoUX.onCameraUnderExposedEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnTangoServiceNotResponding(tangoUX.onTangoServiceNotRespondingEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnTooFewFeatures(tangoUX.onTooFewFeaturesEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnTooFewPoints(tangoUX.onTooFewPointsEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnVersionUpdateNeeded(tangoUX.onVersionUpdateNeededEventHandler);
                    UxExceptionListener.GetInstance.UnregisterOnIncompatibleVMFound(tangoUX.onIncompatibleVMFoundEventHandler);
                }
            }
        }