Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to push data (SQL or LINQ), from WCF Duplex Service to Silverlight client
    primarykey
    data
    text
    <p>I have made simple chat application to learn some new things, and what I want to do now, is to add user list that are currently logged into chat. So I did this:</p> <pre><code> public ObservableCollection&lt;User&gt; GetUserList() { ObservableCollection&lt;User&gt; users = new ObservableCollection&lt;User&gt;(); IEnumerable&lt;User&gt; userEnu; userEnu = from u in _clientDic select new User { UserName = u.Key }; foreach (User user in userEnu) { users.Add(user); } IEnumerable&lt;IDuplexClient&gt; clients; clients = from p in _clientDic select p.Value; foreach (IDuplexClient item in clients) { item.DisplayUserList(users); } return users; } </code></pre> <p>There is also DataConctract that coressponding to User. Anyway. This method get all users that are present in dictionary and put them into ObservableCollection.</p> <p>What I want to do, is to push data from this collection to user, if it change (users log or logout).</p> <p>So far I only managed to manually pull data from Server by calling </p> <pre><code>_client.GetUserListAsync() </code></pre> <p>manually. Trough pushing button in silverlight app. But that's not why I'm using duplex connection, to force user (or client app) for perdiodic calls to server, that check if there is new data or not. I want server to push any new data to client.</p> <pre><code> [ServiceContract] public interface IDuplexClient { [OperationContract(IsOneWay = true)] void DiplayMessage(string message); [OperationContract(IsOneWay = true)] void DisplayUserList(ObservableCollection&lt;User&gt; userColl); } </code></pre> <p>And here is service contract. Honestly I don't really know if this is relevant, but I post it just in case.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload