2016-08-12 71 views
0

我有一个使用Microsoft.Kinect库的WPF程序。 Kinect V2只与Windows 8和更高版本兼容。如何限制WPF程序只能在Windows 8及更高版本上运行

我想知道是否有一个内置的方式有当您尝试在Windows 7,XP打开程序窗口显示错误等

目前该程序立即崩溃的< Windows 8的我知道我可以编写一个自定义的方法,抓取Environment.OSVersion的版本并检查主要版本和次要版本是否相同(Microsoft Versions),但我宁愿有更标准的东西。

我已经尝试添加一个清单给我的项目,我想类似下面的代码,而是选择将被允许运行

<application> 
    <!-- A list of the Windows versions that this application has been tested on and is 
     is designed to work with. Uncomment the appropriate elements and Windows will 
     automatically selected the most compatible environment. --> 

    <!-- Windows Vista --> 
    <!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />--> 

    <!-- Windows 7 --> 
    <!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />--> 

    <!-- Windows 8 --> 
    <supportedos id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" /> 

    <!-- Windows 8.1 --> 
    <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />a 

    <!-- Windows 10 --> 
    <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" /> 

</application> 

由于操作系统!

+0

请勿将代码作为图像发布。 –

回答

0

我会从Environment.OSVersion属性获得操作系统版本。您可能必须稍微玩一下,因为我不能100%确定Windows 8.1 RT会显示什么,除非Kinect库也适用于RT。

相关问题