private void dataGridView1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (bgwSessionInitializer.IsBusy)
     {
         MessageBox.Show("The session is being initialized. Please wait.");
     }
     else
     {
         if (e.RowIndex >= 0 && e.RowIndex < contacts.Contacts.Count)
         {
             ConversationForm frm = new ConversationForm(contacts.Contacts[e.RowIndex].Address);
             frm.Show();
         }
     }
 }
Exemple #2
0
        private void bgwReceiver_DoWork(object sender, DoWorkEventArgs e)
        {
            List<String> ToDelKeys = new List<string>();
            foreach (KeyValuePair<string, ConversationForm> pair in openedConversations)
            {
                if (pair.Value.IsDisposed)
                {
                    ToDelKeys.Add(pair.Key);
                }
            }

            foreach (String key in ToDelKeys)
            {
                openedConversations.Remove(key);
            }

            Queue<Isima.InstantMessaging.Messaging.Message> messages = MessagingContext.Current.MessagingSessionController.ReceiveMessage();
            if (messages != null)
            {
                foreach (Isima.InstantMessaging.Messaging.Message m in messages)
                {
                    if (openedConversations.ContainsKey(m.SenderAddress))
                    {
                        Invoke(new delegDisplayMsg(openedConversations[m.SenderAddress].DisplayMessage),  m, false);
                    }
                    else
                    {
                        ConversationForm frm = new ConversationForm(m.SenderAddress, sessionId);
                        openedConversations.Add(m.SenderAddress, frm);
                        frm.Show();
                        frm.DisplayMessage(m, false);
                    }
                }
            }
        }