void OnReceiveConnectionCompleted(object sender, ReceiveConnectionCompletedEventArgs e) { if(e.Error == null) { MessengerLib.ConnectionRequestData data = e.Result; ChatDlg dlg = new ChatDlg(this, mClient, data.groupGuid, data.userSessionGuid, data.userFrom); mChatDlgDict.Add(data.userFrom, dlg); dlg.Show(); dlg.Activate(); } mClient.ReceiveConnectionAsync(mUserId); }
private void listView1_DoubleClick(object sender, EventArgs e) { if (this.listView1.SelectedItems.Count > 0) { ListViewItem sel = this.listView1.SelectedItems[0]; if (mChatDlgDict.ContainsKey(sel.Text)) { // activate existing wondow mChatDlgDict[sel.Text].Activate(); } else { // create new chat window MessengerLib.ConnectionResultData res = mClient.RequestConnect(mUserId, sel.Text); ChatDlg dlg = new ChatDlg(this, mClient, res.groupGuid, res.userSessionGuid, sel.Text); mChatDlgDict.Add(sel.Text, dlg); dlg.Show(); dlg.Activate(); } } }