Server code updating UI, what is proper way to do this?

Server code updating UI, what is proper way to do this?

Old forum URL: forums.lhotka.net/forums/t/9673.aspx


Savij posted on Monday, October 25, 2010

Hello,

I am using Csla with Silverlight 4. To make things simple, think of an order screen on a POS system, you add items to an order and you can click on items in the order and edit them. Assume that editing a line item can affect other line items. For instance buying a related item in another line affects the price of the first line, etc. The important thing is that line items can affect other line items.

I have an order object which has a child itemsCollection. When an item is added/edited it's handled on the server side via dataportal. So far so good. What I want to do is create a queue collection to handle line item changes. So adding an item, or editing an item is just an object I drop in a queue (just a Csla collection itself). On the server side, I can just loop the queue and process that add's or edits one at a time. The thing is, as I process these edits they can cause other line items to change.

I need a way to tell my Silverlight UI elements in the view to show the line as currently updating.

Even if I iterated the queue on the client and marked the line as busy while they processed, I still wold not see affected lines updating so that doesnt work either.

 How can I update my UI rows, when the items on the server are being processed?  

 

Thanks for any suggestions!

-Jeff

JonnyBee replied on Wednesday, October 27, 2010

Hi,

This is not a supported scenario within Csla DataPortal.

See this thread for more details: http://forums.lhotka.net/forums/t/7369.aspx  

RockfordLhotka replied on Wednesday, October 27, 2010

Jonny is right.

However, maybe this would work:

Use the dual http channel (Silverlight has one - it uses efficient polling from client to server) for the data portal configuration. I think the data portal will work fine with it, though I've never tried.

If the data portal works with the dual channel, then you can pass a callback reference to the server code, so it could do callbacks to the client. You'll have to read through how to use the dual channel to actually do this - I've never looked into it.

So it might not be easy, but it might be possible - at least from Silverlight.

Copyright (c) Marimer LLC