Detect the difference between WinRT and Windows 8

依然范特西╮ 提交于 2020-02-24 07:45:07

问题


For statistic tracking, I'd like to be able to tell if the application is running on Windows RT or Windows Pro.

This thread says that there's no way to get the system version info:

Get OS-Version in WinRT Metro App C#

Any ideas?


回答1:


One thing you could do is to go to Configuration Manager in Visual Studio and instead of the default Any CPU configuration - create separate ARM/x86/x64 configurations and in project properties/Conditional compilation symbols define a symbol that is different for ARM vs. x86/x64 configurations. Then you can just test for it in your code using #if #else #endif preprocessor directives.




回答2:


Detect the architecture of the processor -- if x86/x64 it's not RT. If ARM it's RT.

Use the method here WinRT Replacement of System.Environment.TickCount

But instead of tick count look for the pertinent info.




回答3:


If you want actual processor information without creating multiple binaries check out this helper class I wrote https://github.com/AttackPattern/CSharpAnalytics/blob/master/Source/CSharpAnalytics/SystemInfo/WindowsStoreSystemInfo.cs

Then you can just write:

var cpu = WindowsStoreSystemInfo.GetProcessorArchitecture();


来源:https://stackoverflow.com/questions/13001208/detect-the-difference-between-winrt-and-windows-8

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!