Exemplo n.º 1
0
        /// <summary>
        /// Creates an instance of <see cref="WindowsPhoneDevice" />.
        /// </summary>
        public WindowsPhoneDevice()
        {
            this.Display      = new Display();
            this.PhoneService = new PhoneService();
            this.Battery      = new Battery();
            this.BluetoothHub = new BluetoothHub();

            try
            {
                var result = Windows.Devices.Sensors.Accelerometer.GetDefault()?.DeviceId;

                if (result != null)
                {
                    this.Accelerometer = new Accelerometer();
                }
            }
            catch (Exception)
            {
            }

            try
            {
                var result = Windows.Devices.Sensors.Gyrometer.GetDefault()?.DeviceId;

                if (result != null)
                {
                    Gyroscope = new Gyroscope();
                }
            }
            catch (Exception)
            {
            }

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

            //if (DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.ID_CAP_MEDIALIB_PHOTO))
            //{
            //    MediaPicker = new MediaPicker();
            //}
        }
Exemplo n.º 2
0
        /// <summary>
        /// Prevents a default instance of the <see cref="AndroidDevice"/> class from being created.
        /// </summary>
        private AndroidDevice()
        {
            var manager = Services.PhoneService.Manager;

            if (manager != null && manager.PhoneType != PhoneType.None)
            {
                this.PhoneService = new PhoneService();
            }

            if (Device.Accelerometer.IsSupported)
            {
                Accelerometer = new Accelerometer();
            }

            if (Device.Gyroscope.IsSupported)
            {
                Gyroscope = new Gyroscope();
            }

            if (Services.Media.Microphone.IsEnabled)
            {
                Microphone = new Microphone();
            }

            this.Display = new Display();

            this.Manufacturer    = Build.Manufacturer;
            this.Name            = Build.Model;
            this.HardwareVersion = Build.Hardware;
            this.FirmwareVersion = Build.VERSION.Release;

            this.Battery = new Battery();

            this.MediaPicker = new MediaPicker();

            this.Network = new Network();
        }
        /// <summary>
        /// Creates an instance of <see cref="WindowsPhoneDevice" />.
        /// </summary>
        public WindowsPhoneDevice()
        {			
            this.Display = new Display();
            this.PhoneService = new PhoneService();
            this.Battery = new Battery();
            this.BluetoothHub = new BluetoothHub();

            try
            {
                var result = Windows.Devices.Sensors.Accelerometer.GetDefault()?.DeviceId;

                if (result != null)
                {
                    this.Accelerometer = new Accelerometer();
                }
            }
            catch (Exception)
            {
            }

            try
            {
                var result = Windows.Devices.Sensors.Gyrometer.GetDefault()?.DeviceId;

                if (result != null)
                {
                    Gyroscope = new Gyroscope();
                }
            }
            catch (Exception)
            {
            }
        
            //if (DeviceCapabilities.IsEnabled(DeviceCapabilities.Capability.IdCapMicrophone))
            //{
            //	if (XnaMicrophone.IsAvailable)
            //	{
            //		this.Microphone = new XnaMicrophone();
            //	}
            //}

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