检查UWP Desktop扩展是否存在

isp*_*iro 1 c# windows-store-apps win-universal-app uwp desktop-bridge

我添加了以下行:

FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
Run Code Online (Sandbox Code Playgroud)

文档

但我希望能够检查这是否有效(最好没有try-catch块).有没有办法测试桌面扩展是否存在?

Ste*_*SFT 6

建议的方法是:

if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
{
   await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
}
Run Code Online (Sandbox Code Playgroud)