我正在创建一个共享 InkManager 笔划的应用程序,方法是首先将 inkmanager 笔划保存到本地设置,然后将其作为流读取并共享。
现在 HTML 内容正在共享,但电子邮件中没有附加图像。如果我评论代码以共享 html,则在通过电子邮件应用程序共享时,图像会被附加。但两者都不会立即共享。我怎样才能做到这一点???
代码:
DataPackage requestData = request.Data;
requestData.Properties.Title = this.PageViewModel.JobInformationDetail.JobNumber;
requestData.Properties.Description = this.PageViewModel.JobInformationDetail.CustomerSignatureName;
//requestData.SetText("Sample Text");
RandomAccessStreamReference signatureStream = await GetInkManagerStream();
if (signatureStream != null)
{
requestData.SetBitmap(signatureStream);
}
requestData.SetHtmlFormat(Windows.ApplicationModel.DataTransfer.HtmlFormatHelper.CreateHtmlFormat(this.GetMailDescription()));
将 InkManager 转换为流
private async Task<RandomAccessStreamReference> GetInkManagerStream()
{
IRandomAccessStream signatureStream = null;
StorageFile myMerge = await ApplicationData.Current.LocalFolder.CreateFileAsync("sign.png", CreationCollisionOption.OpenIfExists);
IOutputStream signature = await myMerge.OpenAsync(FileAccessMode.ReadWrite);
if (signature != null)
{
await _inkManager.SaveAsync(signature);
signature.Dispose();
}
signatureStream = await myMerge.OpenAsync(FileAccessMode.ReadWrite);
RandomAccessStreamReference streamRef = RandomAccessStreamReference.CreateFromStream(signatureStream);
signatureStream.Dispose();
return streamRef;
}