/// <summary> /// Initializes a new instance of the <see cref="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(); }
/// <summary> /// Initializes a new instance of the <see cref="Simulator" /> class. /// </summary> internal Simulator() { var b = UIScreen.MainScreen.Bounds; var h = b.Height * UIScreen.MainScreen.Scale; var w = b.Width * UIScreen.MainScreen.Scale; var dpi = UIScreen.MainScreen.Scale * 163; Display = new Display((int)h, (int)w, dpi, dpi); Name = HardwareVersion = "Simulator"; }
/// <summary> /// Initializes a new instance of the <see cref="Pod" /> class. /// </summary> /// <param name="majorVersion">Major version.</param> /// <param name="minorVersion">Minor version.</param> public Pod(int majorVersion, int minorVersion) { Version = (PodVersion)majorVersion; PhoneService = null; Name = HardwareVersion = Version.GetDescription(); if (majorVersion > 4) { Display = new Display(1136, 640, 326, 326); } else if (majorVersion > 3) { Display = new Display(960, 640, 326, 326); } else { Display = new Display(480, 320, 163, 163); } }
/// <summary> /// Initializes a new instance of the <see cref="Phone" /> class. /// </summary> /// <param name="majorVersion">Major version.</param> /// <param name="minorVersion">Minor version.</param> public Phone(int majorVersion, int minorVersion) { PhoneService = new PhoneService(); switch (majorVersion) { case 1: Version = minorVersion == 1 ? PhoneType.IPhone1G : PhoneType.IPhone3G; break; case 2: Version = PhoneType.IPhone3Gs; break; case 3: Version = minorVersion == 1 ? PhoneType.IPhone4Gsm : PhoneType.IPhone4Cdma; break; case 4: Version = PhoneType.IPhone4S; break; case 5: Version = PhoneType.IPhone5Gsm + minorVersion - 1; break; case 6: Version = minorVersion == 1 ? PhoneType.IPhone5SCdma : PhoneType.IPhone5SGsm; break; case 7: Version = minorVersion == 1 ? PhoneType.IPhone6Plus : PhoneType.IPhone6; break; case 8: Version = minorVersion == 1 ? PhoneType.IPhone6S : PhoneType.IPhone6SPlus; break; default: Version = PhoneType.Unknown; break; } switch (Version) { case PhoneType.IPhone6: case PhoneType.IPhone6S: Display = new Display(1334, 750, 326, 326); break; case PhoneType.IPhone6Plus: case PhoneType.IPhone6SPlus: Display = new Display(2208, 1242, 401 * 1242 / 1080, 401 * 2208 / 1920); break; default: if (majorVersion > 4) { Display = new Display(1136, 640, 326, 326); } else if (majorVersion > 2) { Display = new Display(960, 640, 326, 326); } else { Display = new Display(480, 320, 163, 163); } break; } Name = HardwareVersion = Version.GetDescription(); }
/// <summary> /// Initializes a new instance of the <see cref="Pad" /> class. /// </summary> /// <param name="majorVersion">Major version.</param> /// <param name="minorVersion">Minor version.</param> public Pad(int majorVersion, int minorVersion) { PhoneService = null; double baseDPI = 132; switch (majorVersion) { case 1: baseDPI = 132; Version = IPadVersion.IPad1; break; case 2: baseDPI = minorVersion > 4 ? 163 : 132; Version = IPadVersion.IPad2Wifi + minorVersion - 1; break; case 3: baseDPI = minorVersion > 3 ? 163 : 132; Version = IPadVersion.IPad3Wifi + minorVersion - 1; break; case 4: baseDPI = minorVersion > 3 ? 163 : 132; Version = IPadVersion.IPadAirWifi + minorVersion - 1; break; case 5: baseDPI = minorVersion < 3 ? 163 : 132; Version = IPadVersion.IPadMini4 + minorVersion - 1; break; case 6: baseDPI = 132; switch (minorVersion) { case 3: Version = IPadVersion.IPadPro1_97; break; case 4: Version = IPadVersion.IPadPro1_97Cellular; break; case 7: Version = IPadVersion.IPadPro1_129; break; case 8: Version = IPadVersion.IPadPro1_129Cellular; break; } break; default: Version = IPadVersion.Unknown; break; } int width; int height; if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { CoreGraphics.CGRect bounds = UIKit.UIScreen.MainScreen.NativeBounds; width = (int)bounds.Width; height = (int)bounds.Height; } else { //All older devices are portrait by design so treat the default bounds as such CoreGraphics.CGRect bounds = UIKit.UIScreen.MainScreen.Bounds; width = Math.Min((int)bounds.Width, (int)bounds.Height); height = Math.Max((int)bounds.Width, (int)bounds.Height); } width *= (int)UIKit.UIScreen.MainScreen.Scale; height *= (int)UIKit.UIScreen.MainScreen.Scale; double dpi = baseDPI * UIKit.UIScreen.MainScreen.Scale; Display = new Display(height, width, dpi, dpi); Name = HardwareVersion = Version.GetDescription(); }
/// <summary> /// Initializes a new instance of the <see cref="Phone" /> class. /// </summary> /// <param name="majorVersion">Major version.</param> /// <param name="minorVersion">Minor version.</param> public Phone(int majorVersion, int minorVersion) { PhoneService = new PhoneService(); switch (majorVersion) { case 1: Version = minorVersion == 1 ? PhoneType.IPhone1G : PhoneType.IPhone3G; break; case 2: Version = PhoneType.IPhone3Gs; break; case 3: Version = minorVersion == 1 ? PhoneType.IPhone4Gsm : PhoneType.IPhone4Cdma; break; case 4: Version = PhoneType.IPhone4S; break; case 5: Version = PhoneType.IPhone5Gsm + minorVersion - 1; break; case 6: Version = minorVersion == 1 ? PhoneType.IPhone5SCdma : PhoneType.IPhone5SGsm; break; case 7: Version = minorVersion == 1 ? PhoneType.IPhone6Plus : PhoneType.IPhone6; break; case 8: if (minorVersion == 1) { Version = PhoneType.IPhone6S; } else if (minorVersion == 2) { Version = PhoneType.IPhone6SPlus; } else if (minorVersion == 4) { Version = PhoneType.IPhoneSE; } break; default: Version = PhoneType.Unknown; break; } int width; int height; if (UIKit.UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { CoreGraphics.CGRect bounds = UIKit.UIScreen.MainScreen.NativeBounds; width = (int)bounds.Width; height = (int)bounds.Height; } else { //All older devices are portrait by design so treat the default bounds as such CoreGraphics.CGRect bounds = UIKit.UIScreen.MainScreen.Bounds; width = System.Math.Min((int)bounds.Width, (int)bounds.Height); height = System.Math.Max((int)bounds.Width, (int)bounds.Height); } width *= (int)UIKit.UIScreen.MainScreen.Scale; height *= (int)UIKit.UIScreen.MainScreen.Scale; double baseDPI = 163; //dpi from 1st Gen iPhone devices double dpi = baseDPI * UIKit.UIScreen.MainScreen.Scale; if (Version == PhoneType.IPhone6Plus || Version == PhoneType.IPhone6SPlus) { dpi = 401; } Display = new Display(height, width, dpi, dpi); Name = HardwareVersion = Version.GetDescription(); }