1
現在、agxsmpp
フレームワークを使用してクライアントサーバーアプリケーションで作業しています。 agsxmpp
は非同期通信を持ち、機能が完全に実行されるまで待たないでください。rosterlistがOnRosterItemイベントで完全に設定されたときにユーザーインターフェイスに表示する
private void XmppCon_OnRosterItem(object sender, agsXMPP.protocol.iq.roster.RosterItem item)
{
_rosterList.Add(item);
}
ユーザインターフェースウェブフォームコード
ConnectionMangerのConnectionManager =(ConnectionManger)セッション[ "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)
{
}
how ??私は別の層であるユーザーインターフェイス上のリストをバインドするために、APIレイヤとWanと呼ばれる別のレイヤ上のすべてのイベントを持っていますか?リストの登録が完了するまでユーザーインターフェイスを表示しないでください。 – bilal
OnRosterStemイベントのすべての更新をOnRosterStartイベントとOnRosterEndイベントの間で収集し、それらを一度にUIにコミットするだけです。これが、これらのイベントが存在する理由です。 – Alex