分享图片到在线服务

     当把图片分享到在线服务上时,你需要和保存图片一样的方式来缩小图片的尺寸。并且 ShareMediaTask 同时需要你分享的

图片必须保存在图片库中,所以当你分享图片前必须把它首先保存到图片库除非你已经保存过了(或者图片的来源不是图片库)

using Microsoft.Phone.Tasks;
 
... 
 
public partial class PreviewPage : PhoneApplicationPage 
{
    private ShareMediaTask _shareMediaTask = new ShareMediaTask ();
    private string _libraryPath = null;
    
    ...

    private async void Share(IBuffer image)
    {
        if (_libraryPath == null)
        {
            // Saving the photo may throw an exception, for example, if there is not free disk space available
            
            try
            {
                _libraryPath = await Utilities.SaveAsync(image);
            }
            catch (Exception ex)
            {
                return;
            }
        }
        _shareMediaTask.FilePath = _libraryPath;
        _shareMediaTask.Show();
    }

    ...

}

Nokia Wiki 原文链接:http://developer.nokia.com/Resources/Library/Lumia/#!imaging/working-with-high-resolution-photos/sharing-photos-to-online-services.html

原文地址:https://www.cnblogs.com/hebeiDGL/p/3317072.html