-
-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
110 additions
and
69 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace iNKORE.UI.WPF.Modern.Helpers | ||
{ | ||
public static class WinRTHelper | ||
{ | ||
public static bool IsSupported | ||
{ | ||
get | ||
{ | ||
try { return Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.UI.ViewManagement.StatusBar"); } | ||
catch { } | ||
|
||
return false; | ||
} | ||
} | ||
|
||
public static string GetCurrentDeviceFamily() | ||
{ | ||
try | ||
{ | ||
if (IsSupported && Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.System.Profile.AnalyticsInfo")) | ||
{ | ||
return Windows.System.Profile.AnalyticsInfo.VersionInfo.DeviceFamily; | ||
} | ||
} | ||
catch { } | ||
|
||
return null; | ||
} | ||
|
||
public static DeviceFamilyType? GetCurrentDeviceFamilyType() | ||
{ | ||
try | ||
{ | ||
var familyName = GetCurrentDeviceFamily(); | ||
|
||
if (!string.IsNullOrWhiteSpace(familyName)) | ||
{ | ||
if (!Enum.TryParse(familyName.Replace("Windows.", string.Empty), out DeviceFamilyType parsedDeviceType)) | ||
{ | ||
parsedDeviceType = DeviceFamilyType.Other; | ||
} | ||
|
||
return parsedDeviceType; | ||
} | ||
} | ||
catch { } | ||
|
||
return null; | ||
} | ||
} | ||
|
||
public enum DeviceFamilyType | ||
{ | ||
Desktop, | ||
Mobile, | ||
Other, | ||
Xbox | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters