3

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?

Community
  • 1
  • 1
user1567095
  • 480
  • 1
  • 5
  • 13

3 Answers3

3

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.

Filip Skakun
  • 31,624
  • 6
  • 74
  • 100
0

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.

Community
  • 1
  • 1
Matt
  • 25,943
  • 66
  • 198
  • 303
  • I don't think you have the WMI classes available in a WinRT application. And GetEnvironmentVariable is not available on Environment class... WinRT has a different set of classes and methods from normal .NET! – Mattias Lindberg Oct 21 '12 at 19:49
  • And does `System.Environment` work in a Metro App? -edit- saw the updated comment above :) – Silvermind Oct 21 '12 at 19:51
  • I guess not directly, but you could use the method used here. http://stackoverflow.com/questions/10369346/winrt-replacement-of-system-environment-tickcount – Matt Oct 21 '12 at 19:53
0

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();
DamienG
  • 6,575
  • 27
  • 43