public void SetDelegate(ICCAccelerometerDelegate pDelegate)
        {
            m_pAccelDelegate = pDelegate;

            if (pDelegate != null && !m_bActive)
            {
#if !WINDOWS && !PSM && !OUYA && !XBOX360 &&!NETFX_CORE && !MONOMAC && !WINDOWSGL
                    try
                {
                    if (Microsoft.Devices.Sensors.Accelerometer.IsSupported)
                    {
                        accelerometer.CurrentValueChanged += accelerometer_CurrentValueChanged;
                        accelerometer.Start();
                        m_bActive = true;
                    }
                    else
                    {
                        m_bActive = false;
                    }
                }
                catch (Microsoft.Devices.Sensors.AccelerometerFailedException)
                {
                    m_bActive = false;
                }
#endif
                if (!m_bActive)
                {
                    m_bActive = true;
                    m_bEmulation = true;
                }
                else
                {
                    m_bEmulation = false;
                }
            }
            else
            {
                if (m_bActive && !m_bEmulation)
                {
#if !WINDOWS && !PSM && !OUYA && !XBOX360 &&!NETFX_CORE && !MONOMAC && !WINDOWSGL
                    //if (accelerometer != null)
                    //{
                    //    accelerometer.CurrentValueChanged -= accelerometer_CurrentValueChanged;
                    //    accelerometer.Stop();
                    //}
#endif
                }
                
                ResetAccelerometer();

                m_bActive = false;
                m_bEmulation = false;
            }
        }
        public void SetDelegate(ICCAccelerometerDelegate pDelegate)
        {
            m_pAccelDelegate = pDelegate;

            if (pDelegate != null && !m_bActive)
            {
                                #if !WINDOWS && !PSM && !OUYA && !XBOX360 && !NETFX_CORE && !MONOMAC
                try
                {
                    if (Microsoft.Devices.Sensors.Accelerometer.IsSupported)
                    {
                        accelerometer.CurrentValueChanged += accelerometer_CurrentValueChanged;
                        accelerometer.Start();
                        m_bActive = true;
                    }
                    else
                    {
                        m_bActive = false;
                    }
                }
                catch (Microsoft.Devices.Sensors.AccelerometerFailedException)
                {
                    m_bActive = false;
                }
#endif
                if (!m_bActive)
                {
                    m_bActive    = true;
                    m_bEmulation = true;
                }
                else
                {
                    m_bEmulation = false;
                }
            }
            else
            {
                if (m_bActive && !m_bEmulation)
                {
                                        #if !WINDOWS && !PSM && !OUYA && !XBOX360 && !NETFX_CORE && !MONOMAC
                    if (accelerometer != null)
                    {
                        accelerometer.CurrentValueChanged -= accelerometer_CurrentValueChanged;
                        accelerometer.Stop();
                    }
#endif
                }

                ResetAccelerometer();

                m_bActive    = false;
                m_bEmulation = false;
            }
        }