Hello,
How to send a signature from signature control to XML file? I would like to achieve same as it is done in "create order" request document in Mobile Sales in <signature> section.
Sorry, I do not copy you.
I do not have a source code of signature tasklet to check how it is done and I do not want to use existing Microsoft.Dynamics.Mobile.Components.Tasklets.Signature.dll.
As Thomas suggested; I would reuse as many of the excising components as possible if they fits your needs.
However as I understand your question you properly have additional requirements to a signature tasklet.
Here's a couple of steps to extract the signature from the SignatureControl and add the data to the request document:
1) The tasklet must be IRequestContributor; The interface implements a method to add data to request document
2) In the CreateRequest(...) method is where the data is added to the request document; Code for extracting image from signature control and adding it to the request:
using (MemoryStream ms = new MemoryStream())
using (Image image = View.Signature.GetSignatureImage())
{
BitmapFile.Save(image, ms, BitmapFormat.BitsPerPixel1);
signature = ms.ToArray();
ms.Close();
}
Comments
Thomas Rath
Program Manager
Microsoft Dynamics Mobile
I do not have a source code of signature tasklet to check how it is done and I do not want to use existing Microsoft.Dynamics.Mobile.Components.Tasklets.Signature.dll.
Regards,
Marcin
As Thomas suggested; I would reuse as many of the excising components as possible if they fits your needs.
However as I understand your question you properly have additional requirements to a signature tasklet.
Here's a couple of steps to extract the signature from the SignatureControl and add the data to the request document:
1) The tasklet must be IRequestContributor; The interface implements a method to add data to request document
2) In the CreateRequest(...) method is where the data is added to the request document; Code for extracting image from signature control and adding it to the request:
using (MemoryStream ms = new MemoryStream())
using (Image image = View.Signature.GetSignatureImage())
{
BitmapFile.Save(image, ms, BitmapFormat.BitsPerPixel1);
signature = ms.ToArray();
ms.Close();
}
writer.WriteStartElement("signature");
writer.WriteBase64(signature, 0, signature.Length);
writer.WriteEndElement();
Hope this help is sufficient
Tim Skauge
Microsoft Dynamics Mobile
I have done it that way:
byte[] signature = view.GetSignature().GetSignatureBytes();
if (signature != null)
{
writer.WriteStartElement("signature");
writer.WriteBase64(signature, 0, signature.Length);
writer.WriteEndElement();
}
Thank you very much for your help
Cheers,
Marcin