我有下一个问题:
我使用 WinRT XAML Toolkit (code1) 制作了屏幕截图
现在我想将此 WritableBitmap 附加到电子邮件(code2)
代码 1
WriteableBitmap wb = null;
var start = DateTime.Now;
const int count = 1;
for (int i = 0; i < count; i++)
{
wb = await WriteableBitmapRenderExtensions.Render(this);
}
var end = DateTime.Now;
var duration = end - start;
var renderInS = duration.TotalMilliseconds / count;
if (renderInS > 0)
{
test.Source = wb;
// HERE MUST BE CODE INCLUDED
}
代码 2
DataPackage requestData = request.Data;
requestData.Properties.Title = TitleInputBox.Text;
requestData.Properties.Description = DescriptionInputBox.Text; // The description is optional.
// It's recommended to use both SetBitmap and SetStorageItems for sharing a single image
// since the target app may only support one or the other.
List<IStorageItem> imageItems = new List<IStorageItem>();
imageItems.Add(this.imageFile);
requestData.SetStorageItems(imageItems);
RandomAccessStreamReference imageStreamRef = RandomAccessStreamReference.CreateFromFile(this.imageFile);
requestData.Properties.Thumbnail = imageStreamRef;
requestData.SetBitmap(imageStreamRef);
succeeded = true;
这意味着我需要先将图像保存到本地存储,然后读取并附加它。
问题:
1) 如何将 WritableBitmap 保存到应用程序本地存储?
2)也许有办法不保存图像来附加它?