在Windows 8的来宾帐户中如何确定Windows的版本?

时间:2013-10-24 10:59:00

标签: c# windows-8 windows-8.1

当我们从Windows 8中的来宾帐户登录并尝试查找版本时,它会给出错误和与Windows 8相同的值。请建议一些适用于Windows 8和Windows 8.1的代码或API

1 个答案:

答案 0 :(得分:0)

这为您提供了一些背景知识: How can we check if the current OS is win8 or blue

这对我有用:

// this might only work as long as there's no successor to Windows 8.1
public Version GetVersion()
{
   var reportedVersion = System.Environment.OSVersion.Version;
   if (reportedVersion.Major==6 && reportedVersion.Minor==2)
   {
      bool _IsWindows8Point1OrGreater = Type.GetType("Windows.UI.Xaml.Controls.Flyout, Windows.UI.Xaml, ContentType=WindowsRuntime", false) != null;
      if(_IsWindows8Point1OrGreater )
      reportedVersion = new Version(6,3); 
   }
   return reportedVersion;
}