コード例 #1
0
        void tvUser_NodeMouseDoubleClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            var ip = e.Node.Tag as IPAddress;
            IList <FromChat> formli = new List <FromChat>();

            //lock (formobj)
            {
                formli = ChatFormli.ToList();
            }
            foreach (FromChat v in formli)
            {
                if (IPAddress.Equals(v.Remoteip, ip))
                {
                    //v.RecEvent(e);
                    v.WindowState = FormWindowState.Normal;
                    v.BringToFront();
                    return;
                }
            }
            FromChat form = new FromChat(ip);

            form.FormClosing += form_FormClosing;
            form.Show();
            //lock (formobj)
            {
                ChatFormli.Add(form);
            }
        }
コード例 #2
0
 void MyMessage_MsgEvent(object sender, Msg e)
 {
     //throw new NotImplementedException();
     if (!this.IsDisposed && this.IsHandleCreated)
     {
         this.BeginInvoke(new Action(() =>
         {
             IList <FromChat> formli = new List <FromChat>();
             //lock (formobj)
             {
                 formli = ChatFormli.ToList();
             }
             foreach (FromChat v in formli)
             {
                 if (IPAddress.Equals(v.Remoteip, e.IpAddress))
                 {
                     //v.RecEvent(e);
                     return;
                 }
             }
             FromChat form     = new FromChat(e.IpAddress);
             form.FormClosing += form_FormClosing;
             form.Show();
             //lock (formobj)
             {
                 ChatFormli.Add(form);
             }
             form.RecMsg(e);
         }));
     }
 }