0
votes

I am trying to create a sample in which a user can sign using touch based device or mouse. Probably we can use canvas. but now we need to send that sign through share charm. How can i capture that sign and send it as share email attachment?

I haven't written any code. Please guide me if I can get any where any sample to write this functionality down or any other help.

Now I have written some code but how can I convert IRandomAccessStream to RandomAccessStreamReference. I need RandomAccessStreamReference as SetBitmap option while sharing takes RandomAccessStreamReference. So can I change IRandomAccessStream to RandomAccessStreamReference. Here is the code:

IRandomAccessStream signatureStream = null;
            StorageFile myMerge = await ApplicationData.Current.LocalFolder.CreateFileAsync("sign.png");
            IOutputStream signature = await myMerge.OpenAsync(FileAccessMode.ReadWrite);


            if (signature != null)
            {
                await _inkManager.SaveAsync(signature);
                signatureStream = await myMerge.OpenReadAsync();
            }

            return signatureStream;

Thanks I got it use RandomAccessStreamReference.CreateFromStream.

1

1 Answers

1
votes

There is way right now to share images as email attachments other than simply sharing an image with other apps, which may or may not be mail. You would need to save the signature as an image and share it. I am sure there are plenty of samples for using share charms. As for rendering images - it is a bit more involved and you should probably use Direct2D or some wrappers like SharpDX or WinRT XAML Toolkit's WriteableBitmap.Render() implementation. If you're not too concerned about quality or performance - you could also try something like WriteableBitmapEx - it might be simpler and still work OK for your scenario.