Ejemplo n.º 1
0
        /// <summary>
        /// Dispose this instance.
        /// </summary>
        public void Dispose()
        {
            if (m_InstancePluginKinect != null)
            {
                lock (this)
                {
                    if (PluginKinect.InstancePluginKinect.Kinect != null)
                    {
                        // Stop the Kinect module
                        if (PluginKinect.InstancePluginKinect.Kinect.IsRunning)
                        {
                            StopModuleKinect();
                        }

                        // Destroy the Kinect module
                        PluginKinect.InstancePluginKinect.Kinect.Dispose();
                        m_refKinectModule = null;
                    }

                    if (PropertiesPluginKinect.Instance != null)
                    {
                        PropertiesPluginKinect.Instance.Dispose();
                    }

                    m_InstancePluginKinect = null;
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initialize the plugin kinect and start this if necessary
        /// </summary>
        /// <param name="start">Indicate if the kinect must be started</param>
        private void InitializePluginKinect(bool start)
        {
            if (m_InstancePluginKinect == null)
            {
                m_refThreadWebServiceRequest = new Thread(LaunchWebServiceRequest);
                m_refThreadWebServiceRequest.Start();

                // Save PluginKinect instance
                m_InstancePluginKinect = this;

                // Create the Kinect Module
                m_refKinectModule = new KinectModule();

                if (start)
                {
                    // Start the Kinect Module
                    StartModuleKinect();
                }
            }
            else
            {
                throw new KinectException("Kinect already instantiate");
            }
        }