检查UWP Desktop扩展是否存在

时间:2018-03-18 13:15:43

标签: c# uwp windows-store-apps win-universal-app desktop-bridge

我添加了以下行:

FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

docs

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

1 个答案:

答案 0 :(得分:6)

建议的方法是:

if (ApiInformation.IsApiContractPresent("Windows.ApplicationModel.FullTrustAppContract", 1, 0))
{
   await FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();
}