示例#1
0
 // Open a new Chat Window or "push" the message to a existing one
 public void OpenChat(string content, string param)
 {
     for (int n = 0; n < 10; n++)
     {
         try
         {
             if (freechats[n])
             {
                 for (int x = 0; x < 10; x++)
                 {
                     if (chat[x].Buddy == content)
                     {
                         chat[x].ReceiveMessage(param);
                         x = 10;
                         n = 10;
                     }
                 }
             }
         }
         catch
         {
             chat[n] = new Chat(content, Client, this, n, statusImages);
             chat[n].Show();
             chat[n].ReceiveMessage(param);
             chat[n].Text = content;
             freechats[n] = false;
             break;
         }
     }
 }
示例#2
0
        // Open a new Chat window for the clicked user
        public void lb_buddylist_DoubleClick(object sender, EventArgs e)
        {
            int already_open = 0;
            for (int n = 0; n < 10; n++)
            {
                try
                {
                    if (chatbuddies[n] == lb_buddylist.SelectedItems[0].Text)
                    {
                        already_open = 1;
                    }
                }
                catch (ArgumentOutOfRangeException)
                {
                }
            }

            if (already_open != 1)
            {
                for (int i = 0; i < 10; i++)
                {
                    if (freechats[i])
                    {
                        try
                        {
                            chat[i] = new Chat(lb_buddylist.SelectedItems[0].Text, Client, this, i, statusImages);
                            freechats[i] = false;
                            chat[i].Show();
                            chat[i].Text = lb_buddylist.SelectedItems[0].Text;
                            i = 10;
                            try
                            {
                                for (int x = 0; x < 10; x++)
                                {
                                    if (chatbuddies[x] == "")
                                    {
                                        chatbuddies[x] = lb_buddylist.SelectedItems[0].Text;
                                    }
                                    lastvalue = x;
                                }
                            }
                            catch (IndexOutOfRangeException)
                            {
                                chatbuddies[1] = lb_buddylist.SelectedItems[0].Text;
                            }
                        }
                        catch (ArgumentOutOfRangeException)
                        {
                        }
                        break;
                    }
                }
            }
        }