コード例 #1
0
ファイル: Pad.cs プロジェクト: rvenky77/Xamarin-Forms-Labs
        /// <summary>
        /// Initializes a new instance of the <see cref="Xamarin.Forms.Labs.Pad"/> class.
        /// </summary>
        /// <param name="majorVersion">Major version.</param>
        /// <param name="minorVersion">Minor version.</param>
        internal Pad(int majorVersion, int minorVersion)
        {
            PhoneService = null;
            double dpi;
            switch (majorVersion)
            {
                case 1:
                    Version = iPadVersion.iPad1;
                    Display = new Display(1024, 768, 132, 132);
                    break;
                case 2:
                    dpi = minorVersion > 4 ? 163 : 132;
                    Version = iPadVersion.iPad2Wifi + minorVersion - 1;
                    Display = new Display(1024, 768, dpi, dpi);
                    break;
                case 3:
                    Version = iPadVersion.iPad3Wifi + minorVersion - 1;
                    Display = new Display(2048, 1536, 264, 264);
                    break;
                case 4:
                    dpi = minorVersion > 3 ? 326 : 264;
                    Version = iPadVersion.iPadAirWifi + minorVersion - 1;
                    Display = new Display(2048, 1536, dpi, dpi);
                    break;
                default:
                    Version = iPadVersion.Unknown;
                    break;
            }

            Name = HardwareVersion = Version.GetDescription();
        }
コード例 #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="Xamarin.Forms.Labs.WindowsPhoneDevice" /> class.
        /// </summary>
        private WindowsPhoneDevice()
        {
            Display = new Display();
            PhoneService = new PhoneService();
            Battery = new Battery();

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

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

            MediaPicker = new MediaPicker();
        }
コード例 #3
0
        /// <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();
            //}
        }