I try to save a screenshot into the DB. But I cannot figure out the RIA Services method signature to do it. Any clue, please!
///////// Client Code /////////////////
Graphics gfx;
Bitmap bmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
gfx = Graphics.FromImage(bmp);
gfx.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
//////////////////////////////////////
[Invoke]
public void SaveScreen(?????)
{
}
Thank you!!!
The server code has to look like this:
[Invoke]
public void SaveScreen(byte[] image)
{
// Code to store the image in the database
}
For using this you just have to write the bitmap into an array of bytes (for example by saving it to a MemoryStream
and invoking the stream's ToArray()
method) and push it to the server.