2016-08-12 72 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。

相關問題