Reputation: 658
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