C# 将激活的事件添加到toast通知时出错
我已经在我的程序中添加了一个toast通知,并对其进行了编译,它的工作方式与预期的一样 将显示toast通知 之后,我添加了激活的事件:C# 将激活的事件添加到toast通知时出错,c#,windows-8,toast,C#,Windows 8,Toast,我已经在我的程序中添加了一个toast通知,并对其进行了编译,它的工作方式与预期的一样 将显示toast通知 之后,我添加了激活的事件: toast.Activated += toast_Activated; void toast_Activated(ToastNotification sender, object args) { } 尝试编译此代码时,我遇到以下错误: 属性、索引器或事件 未激活“Windows.UI.Notifications.ToastNotification.Act
toast.Activated += toast_Activated;
void toast_Activated(ToastNotification sender, object args)
{
}
尝试编译此代码时,我遇到以下错误:
属性、索引器或事件
未激活“Windows.UI.Notifications.ToastNotification.Activated”
语言支持;尝试直接调用访问器方法
“Windows .ui.NoTosith.ToStaseNo.AddioAc激活(Windows .Fase. TypedEventHandler)”
或
'Windows.UI.Notifications.ToastNotification.remove_Activated(System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken)'
我做错了什么?我在从桌面应用程序示例复制发送toast通知时遇到了完全相同的问题。在检查了几个小时与示例的所有差异后,我发现我错误地添加了对“System.Runtime.InteropServices.dll”的引用,而不是对“System.Runtime.InteropServices.WindowsRuntime.dll”的引用。将引用更改为后者,效果很好。C:\Program Files(x86)\reference Assembly\Microsoft\Framework\.NETFramework\v4.5\Facades\System.Runtime.InteropServices.WindowsRuntime.dll