I have a signaturepadcanvasview control that allows me to capture the stroke but now I need to record it and I can not find how. Searching the internet, I only see ten entries, and what I see is using an Async function with wait, but I can not get it to work.
The theme is to capture the image, and upload it to a folder on a website, with permission to write.
I'm using xamarin, and c #.
I have this piece right now,
private async void onSaveAsync(object sender, EventArgs e)
{ // recuperar imagen
Stream x= await signature.GetImageStreamAsync(SignatureImageFormat.Png);
string saveTo = "some path to save";
// create a write stream
FileStream writeStream = new FileStream(saveTo,
FileMode.Create,FileAccess.Write);
// write to the stream
ReadWriteStream(x,writeStream);
}
private void onDelete(object sender, EventArgs e)
{
// limpiar el SignaturePad
signature.Clear();
}
private void ReadWriteStream(Stream readStream, Stream writeStream)
{
int Length = 256;
Byte[] buffer = new Byte[Length];
int bytesRead = readStream.Read(buffer, 0, Length);
// write the required bytes
while (bytesRead > 0)
{
writeStream.Write(buffer, 0, bytesRead);
bytesRead = readStream.Read(buffer, 0, Length);
}
readStream.Close();
writeStream.Close();
}
My doubt is promptly in:
string saveTo="some path to save";
I do not know what I should do to record it on a website, for example, a page that I have or if there is another way to do it.
Thanks