简体   繁体   English

如何在Template10中覆盖OnShareTargetActivated

[英]How to override OnShareTargetActivated in Template10

I have a project that needs to receive data from Share-UI Windows 10. I have read documentation from Microsoft ( https://docs.microsoft.com/en-us/windows/uwp/app-to-app/receive-data ) and from that doc it says needs to override OnShareTargetActivated. 我有一个项目需要从Share-UI Windows 10接收数据。我从Microsoft阅读了文档( https://docs.microsoft.com/zh-cn/windows/uwp/app-to-app/receive-data ),并从该文档中说需要覆盖OnShareTargetActivated。 my question is how to override OnShareTargetActivated in Template10?. 我的问题是如何在Template10中覆盖OnShareTargetActivated? so far what I can learn are only this. 到目前为止,我能学到的仅仅是这个。

在此处输入图片说明

We do not need to override OnShareTargetActivated in Template10. 我们不需要重写Template10中的OnShareTargetActivated In the Template10.Common.BootStrapper class, we can see the OnShareTargetActivated that is a sealed method. Template10.Common.BootStrapper类中,我们可以看到作为密封方法的OnShareTargetActivated We can not override the OnShareTargetActivated . 我们不能覆盖OnShareTargetActivated

In Template 10, the OnStartAsync is the one and only entry point to an application. 在模板10中, OnStartAsync是应用程序的唯一入口点。 In the OnStartAsync method, we can use the IActivatedEventArgs.Kind to get the ActivationKind. OnStartAsync方法中,我们可以使用IActivatedEventArgs.Kind来获取ActivationKind。 If it is activation by ShareSource, it will return ShareTarget . 如果通过ShareSource激活,它将返回ShareTarget Then we can convert IActivatedEventArgs to ShareTargetActivatedEventArgs . 然后,我们可以将IActivatedEventArgs转换为ShareTargetActivatedEventArgs

There is a sample for ShareTarget in Template10, please refer it. Template10中有一个ShareTarget的示例,请参考它。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM