但如果我打电话给
DataTransferManager.ShowShareUI();
我只有两个选择。但在照片应用程序中,当我分享照片时,我会看到所有兼容的应用程序,例如Instagram。但我的应用只有两个。
答案 0 :(得分:2)
看起来你的代码只共享实际的位图:
req.data.SetBitmap(rasr)
在您安装的应用中,只有Mail和OneNote知道如何处理位图。这是相当常见的,许多共享目标将接受bitmap file但不接受位图本身。见How to share files
// Because we are making async calls in the DataRequested event handler,
// we need to get the deferral first.
DataRequestDeferral deferral = req.GetDeferral();
// Make sure we always call Complete on the deferral.
try
{
StorageFile logoFile =
await Package.Current.InstalledLocation.GetFileAsync("Assets\\beautiful_folder\\and_a_beautiful_file.jpg");
List<IStorageItem> storageItems = new List<IStorageItem>();
storageItems.Add(logoFile);
req.Data.SetStorageItems(storageItems);
}
finally
{
deferral.Complete();
}