我试图在Windows Phone 8.1 app中实现共享机制。 我希望能够分享一些应用程序内容,并在应用程序意义上对其做出反应,
到目前为止,我设法制作了
protected override void OnNavigatedTo(NavigationEventArgs e)
{
this._navigationHelper.OnNavigatedTo(e);
DataTransferManager.GetForCurrentView().DataRequested += OnDataRequested;
DataTransferManager.GetForCurrentView().TargetApplicationChosen += SenderOnTargetApplicationChosen;
}
private async void OnDataRequested(DataTransferManager sender, DataRequestedEventArgs args)
{
_facebookPicked = false;
var request = args.Request;
var shareDescription = ResourceLoader.GetForCurrentView().GetString("ShareDescription");
var deferral = args.Request.GetDeferral();
request.Data.Properties.Title = "Some title";
request.Data.Properties.Description = "sometext";
deferral.Complete();
}
private void SenderOnTargetApplicationChosen(DataTransferManager sender, TargetApplicationChosenEventArgs args)
{
if (args.ApplicationName == "Facebook")
{
_facebookPicked = true;
}
}
如果有人在选择目标应用时按下了分享按钮,我将无法弄清楚该怎么做。我可以拦截任何事件吗?