Pergunta

I'm developing an app for Windows 8, but I want to know if there's a way to know the version of Windows 8, because if it's Windows 8 RT I want the app only shows 2 options, for example, but if the app is running on Windows 8 Pro I want the app has the total functions.

I know when you create the packages in Visual Studio you can select the type or architecture you want for the app, but I don't know if with C# or JavaScript in the case of an app with HTML5 you can detect the architecture to know the version of Windows 8.

Foi útil?

Solução

I think you are mixing the meanings of architecture and OS version.
OS version you are looking for is actually a Windows Edition and it has nothing to do with CPU architecture.
As for your question, I think you are looking for this:

using System.Management;
var name = (from x in new ManagementObjectSearcher("SELECT * FROM Win32_OperatingSystem").Get().OfType<ManagementObject>()
                      select x.GetPropertyValue("Caption")).FirstOrDefault();
return name != null ? name.ToString() : "Unknown";

taken from here

Regarding JavaScript I'm pretty sure that at least for now there is no way to know the edition.

Outras dicas

I don't know if the RT part comes through, but this blog has an example of extracting OS information using the kernel32.dll in C#.

chsarp411 Tutorial

Stackoverflow Posting

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top