bilal
bilal

Reputation: 658

Show RosterList on user Interface when rosterlist gets fully populate on OnRosterItem event

Currently, am working on client server application using agxsmpp framework, I want to display the roster list on user interface when roster list gets fully populated on OnRosterItem event . agsxmpp has async communication, do not wait until function fully executes.

 private void XmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item)
        {

            _rosterList.Add(item);
        }

user interface webform code

ConnectionManger connectionManager = (ConnectionManger)Session["xmppClientConnection"];

    do
    {
         //wait until rosteritem not yet completed
         //this is not a good way how can I do this with another approach
    } while (connectionManager.RosterManager.RosterList.Count == 0);
    foreach (RosterItem item in connectionManager.RosterManager.RosterList)
    {

    }        

Upvotes: 1

Views: 115

Answers (1)

Alex
Alex

Reputation: 4136

You can use the OnRosterStart and OnRosterEnd events for this.

Upvotes: 1

Related Questions