Skip to content
This repository has been archived by the owner on Apr 3, 2023. It is now read-only.

Commit

Permalink
Fix UWP issues
Browse files Browse the repository at this point in the history
- Fix IsDevice property get false on the real device
- Fix crash when I call deviceInfo.Platform in UWP unit test
  • Loading branch information
lunelake committed Jun 13, 2018
1 parent 7c8ea3d commit f1c6bfe
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/DeviceInfo.Plugin/DeviceInfo.uwp.cs
Expand Up @@ -137,9 +137,16 @@ public Abstractions.Platform Platform
case "Windows.Mobile":
return Abstractions.Platform.WindowsPhone;
case "Windows.Desktop":
return UIViewSettings.GetForCurrentView().UserInteractionMode == UserInteractionMode.Mouse
? Abstractions.Platform.Windows
: Abstractions.Platform.WindowsTablet;
try
{
return UIViewSettings.GetForCurrentView().UserInteractionMode == UserInteractionMode.Mouse
? Abstractions.Platform.Windows
: Abstractions.Platform.WindowsTablet;
}
catch
{
return Abstractions.Platform.Windows;
}
case "Windows.IoT":
return Abstractions.Platform.IoT;
case "Windows.Xbox":
Expand Down Expand Up @@ -212,6 +219,6 @@ public Idiom Idiom
///
/// Source: http://igrali.com/2014/07/17/get-device-information-windows-phone-8-1-winrt/
/// </summary>
public bool IsDevice => deviceInfo.SystemProductName == "Virtual";
public bool IsDevice => deviceInfo.SystemProductName != "Virtual";
}
}

0 comments on commit f1c6bfe

Please sign in to comment.