[WP8.1]如何在WP8.1中分享社交媒体上的图像? [英] [WP8.1]How to share image on social Media in WP8.1 Rt??
问题描述
我在wp8.1 rt中创建了应用程序。当点击按钮时,我需要拍摄页面的屏幕截图并在社交媒体上分享(如facebook,twiter,...)。
I have created app in wp8.1 rt. When button is clicked i need to take screen shot of page and share it on social media(like facebook,twiter ,...).
到目前为止我所做的是 -
Upto now what i have done is -
DataTransferManager dtManager = DataTransferManager.GetForCurrentView();
    dtManager.DataRequested + = dtManager_DataRequested;
DataTransferManager dtManager = DataTransferManager.GetForCurrentView();
dtManager.DataRequested += dtManager_DataRequested;
private async void dtManager_DataRequested(DataTransferManager sender,DataRequestedEventArgs e)
      {
$
          e.Request.Data.Properties.Title =" here is title"; $
          e.Request.Data.Properties.Description =" H ..........";
          e.Request.Data.SetWebLink(new Uri(" http://......."));
$
//这里我需要添加图片
      }
private async void dtManager_DataRequested(DataTransferManager sender, DataRequestedEventArgs e)
{
e.Request.Data.Properties.Title = "here is title";
e.Request.Data.Properties.Description = "H..........";
e.Request.Data.SetWebLink(new Uri("http://......."));
//here i need to add image also
}
private void share_Click(object sender,RoutedEventArgs e)
      {
$
          Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
      }
private void share_Click(object sender, RoutedEventArgs e)
{
Windows.ApplicationModel.DataTransfer.DataTransferManager.ShowShareUI();
}
在这里它的工作,我能够分享标题,描述,....但无法分享捕获的图像以编程方式
Upto here its working ,i am able to share title, discription,.... but unable to share image that capture programatically
为了捕获图像,我所做的工作如下:
For capturing image what i have done is below:
Image img = await CreateBitmapFromElement(rootcontent); //这里rootcontent是我需要捕获的网格名称。
Image img= await CreateBitmapFromElement(rootcontent); //here rootcontent is my grid name that i need capture.
在这里我也可以获得imge。现在我希望这个捕获的图像也可以共享。我该怎么做?
Here i am able to get imge also. Now i want this captured image also to be share. How can i do that ??
谢谢
推荐答案
Hello
Jayanta Rijal ,
>>在这里我也能得到imge。现在我希望这个捕获的图像也可以共享。我该怎么做?
为了在Windows运行时共享图像,它与共享过程的过程非常相似文本。您可以使用requestData.SetStorageItems()或requestData.SetBitmap()方法来设置共享imgae数据。有关详细信息,您可以查看此
样本:
https://code.msdn.microsoft.com/windowsapps/Sharing-Content-Source-App-d9bffd84 跨度>
顺便提一下,请检查
本指南发布为线程标题添加适当的标签。
By the way, please also check this guide post to add a proper tag for the thread title.
问候。
这篇关于[WP8.1]如何在WP8.1中分享社交媒体上的图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!