c# - 检查 UWP 桌面扩展是否存在

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

我添加了以下行:

FullTrustProcessLauncher.LaunchFullTrustProcessForCurrentAppAsync();

docs

但我希望能够检查这是否可行(最好没有 try-catch block )。有什么方法可以测试桌面扩展是否存在?

最佳答案

推荐的方法是:

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

关于c# - 检查 UWP 桌面扩展是否存在,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49348289/

相关文章:

c# - WebView 中的 WebGL 在 UNO 构建中不起作用,但在 Xamarin 构建中起作用

c# - 使用 Filehelpers 处理 DelimitedRecord 中的换行符

windows-phone-8.1 - Windows Phone Runtime 应用程序短信

c# - 使用 protobuf-net 为 Windows 应用商店应用程序序列化私有(private)成员

c# - Windows 8 Metro 录制音频(过滤噪音、改变音调)

c# - 遍历数组并找到部分字符串

c# - 如何制作具有透明背景的禁用 RichTextbox?

c# - 如何在 UWP 应用程序中获取当前在 Azure VM 中运行的进程列表

mvvm - UWP 绑定(bind)到 MVVM 中的 AutoSuggestBox

c# - 如何从 Windows8 商店应用程序中的字节数组获取流