static DeviceInfo() { deviceInfo = new EasClientDeviceInformation(); currentIdiom = DeviceIdiom.Unknown; try { systemProductName = deviceInfo.SystemProductName; } catch (Exception ex) { Debug.WriteLine($"Unable to get system product name. {ex.Message}"); } }
static DeviceIdiom GetIdiom() { switch (AnalyticsInfo.VersionInfo.DeviceFamily) { case "Windows.Mobile": currentIdiom = DeviceIdiom.Phone; break; case "Windows.Universal": case "Windows.Desktop": { try { var currentHandle = Essentials.Platform.CurrentWindowHandle; var settings = UIViewSettingsInterop.GetForWindow(currentHandle); var uiMode = settings.UserInteractionMode; currentIdiom = uiMode == UserInteractionMode.Mouse ? DeviceIdiom.Desktop : DeviceIdiom.Tablet; } catch (Exception ex) { Debug.WriteLine($"Unable to get device . {ex.Message}"); } } break; case "Windows.Xbox": case "Windows.Team": currentIdiom = DeviceIdiom.TV; break; case "Windows.IoT": default: currentIdiom = DeviceIdiom.Unknown; break; } return(currentIdiom); }