Wednesday, May 7, 2008

Creating a CWA client with Silverlight 2 beta 1 (part 4)

In Part 3 we have seen how to setup our session. In this part we’re going to get the events from the server. In this case we are not going to use synchronous calls, but asynchronous calls. We do not want to block our UI thread.
Let’s get back to our UserAgent class and create our CheckEvents Method. If there is still a request to the server running, don’t create a new request. You get some internal error you can’t catch!!!
This has to be a public Method. I’ll explain in the next Part why. But First we have to create our data channel Url.

image

The datachannel url needs two parameters we have to provide.
Of course the Sid (the id of the session we created) and the AckID (acknowledge ID).
With the AckID we let the CWA server know which events we already got. If we don’t send the new acknowledge ID with our request, we get all events over and over again.
Next create our CkeckEvents method.

image

So we got our response. Let’s handle the response stream we got back.

image

First thing you see is that we get the ackID from the response. We’ll send it with the next request we make. Let’s process our ContactGroups.

image

Next is we have to create a user class and a group class so we can store our information. Then we have to create extra eventArgs so we can raise Events to our Silverlight application to handle them in our UI.

image

image

So we now we can handle some events. Next is how we can set a timer to get call the CheckEvents Method and do something in our Silverlight application to actually show we got something back.
We going to make a start with that in the next Part of this series.
Please note that this is a series how you can create a cwa silverlight application, not a complete sample yet.

Any questions/ comments please feel free to contact us.
Sip:Marc.Wetters@e-office.com or email:Marc.Wetters@e-office.com or Sip:Joachim.Farla@e-office.com or email:Joachim.Farla@e-office.com

No comments: