Пример #1
0
        /// <summary>
        /// Prevents a default instance of the <see cref="WindowsPhoneDevice"/> class from being created.
        /// </summary>
        private WindowsPhoneDevice()
        {
            this.Display      = new Display();
            this.PhoneService = new PhoneService();
            this.Battery      = new Battery();
            this.BluetoothHub = new BluetoothHub();

            if (DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_SENSORS))
            {
                if (Microsoft.Devices.Sensors.Accelerometer.IsSupported)
                {
                    this.Accelerometer = new Accelerometer();
                }

                if (Microsoft.Devices.Sensors.Gyroscope.IsSupported)
                {
                    this.Gyroscope = new Gyroscope();
                }
            }

            if (DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_MICROPHONE))
            {
                if (XnaMicrophone.IsAvailable)
                {
                    this.Microphone = new XnaMicrophone();
                }
            }

            //if (DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_MEDIALIB_PHOTO))
            //{
            //    MediaPicker = new MediaPicker();
            //}
        }
        /// <summary>
        /// Prevents a default instance of the <see cref="WindowsPhoneDevice"/> class from being created.
        /// </summary>
        private WindowsPhoneDevice()
        {
            Display      = new Display();
            PhoneService = new PhoneService();
            Battery      = new Battery();

            if (DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_SENSORS))
            {
                if (Microsoft.Devices.Sensors.Accelerometer.IsSupported)
                {
                    this.Accelerometer = new Accelerometer();
                }

                if (Microsoft.Devices.Sensors.Gyroscope.IsSupported)
                {
                    this.Gyroscope = new Gyroscope();
                }
            }

            //if (DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_MEDIALIB_PHOTO))
            //{
            //    MediaPicker = new MediaPicker();
            //}
        }