问题描述
这个问题基本上是与Possible使用敬酒通知从一个普通的.NET应用程序?
我如何使用Windows.UI命名空间从常规(无店铺)的Win32 .NET应用程序(控制台,的WinForms,WPF)?
How can I use the Windows.UI namespace from a regular (Non-Store) Win32 .NET application (Console, WinForms, WPF)?
推荐答案
某些WinRT的类可以从桌面应用程序,包括Windows.UI命名空间的一部分使用。敬酒通知API是一个这样的例子 - 它们可以同时用于Windows应用商店的应用程序和桌面应用程序。在API参考部分,每一类网页显示,如果API适用于Windows应用商店的应用程序或桌面应用程序(的)。有使用Toast通知的API从桌面应用提供一个样本MSDN上。
MSDN包含一个full在WinRT的类可用于台式机的列表应用。
编辑:
添加一个引用到的WinRT API的能力是默认关闭在C#桌面应用程序。该项目需要专门针对Windows 8的平台。要添加引用的WinRT的API(该Windows.winmd组装),以下内容添加到您的项目文件:
The ability to add a reference to the WinRT APIs is off by default in C# desktop apps. The project needs to specifically target the Windows 8 platform. To add a reference to WinRT APIs (the Windows.winmd assembly), add the following to your project file:
<PropertyGroup>
<TargetPlatformVersion>8.0</TargetPlatformVersion>
</PropertyGroup>
补充说,该项目建成后,一个Windows选项卡将出现在引用管理器对话框,您可以添加Windows组件。欲了解更多信息,请参阅核心小组在此 MSDN文章。
这篇关于我如何使用Windows.UI命名空间从常规(无店铺)的Win32 .NET应用程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!