Hi this is my first WCF,
I have read the past day on how to this, and for the most part I have a good understanding of it ( I think ), but it seems I'm just missing something a little bit. allow me to explain.
I have a project currently that draws fractals and is multi-threaded & parallelized the heart of this project is The function "CalcFractel()" the current version of the project is running and debugged. Now for the next version of this project I need to offload the processing portion to a webservice thats where WCF comes in. From what I have read both here with the great tutorials I have understood the following the IServices.cs is the interface which you need to implement in services.svc.cs. So here is what I have added to the auto generated IServices.cs I'm using VS 2010 Ultimate I don't if that matters thought I mention it. And I have already checked the "Generate asynchronous operations" check box under the Service references list.
[OperationContract]
Bitmap CalcFractel(int width, int height, float complexX, float complexY);
on the implementation side (ie Services.cs)I did the following.
public Bitmap CalcFractel(int width, int height, float complexX, float complexY)
{
Bitmap bmp = new Bitmap(width, height);
if ((width != 0) && (height != 0))
{
Graphics g = Graphics.FromImage(bmp);
SolidBrush b = new SolidBrush(Color.Aqua);
Rectangle r = new Rectangle(0, 0, width, height);
g.FillRectangle(b, r);
return bmp;
}
else
return null;
}
On the client side I added the following code... so in the Event Handler
"client_GetDataCompleted(object sender, ServiceReference1.GetDataCompletedEventArgs e)" I don't know how to get at the bitmap.. I thought e.result would have what i was returning in the function on the server side but I just get a type string. This is the the last piece I need I figured the rest out on my own, and if you can help well any help would be greatly appreciated.
<pre lang="msil">private void Test_Click(object sender, EventArgs e)
{
ServiceReference1.Service1Client client = new ServiceReference1.Service1Client();
client.GetDataCompleted += new EventHandler<ServiceReference1.GetDataCompletedEventArgs>(client_GetDataCompleted);
}
and the Event handler
oid client_GetDataCompleted(object sender, ServiceReference1.GetDataCompletedEventArgs e)
{
Bitmap bmp = e.Result.
}
thanks,
:-O :confused: