Example #1
0
        delegate void AddTextToDisplayDelegate(String Cont);// gọi phương thức bất kì đâu

        private void AddTextToChatDisplay(String Cont)
        {
            if (this.InvokeRequired)//cho biết có yêu cầu Invoke ko
            {
                AddTextToDisplayDelegate d = new AddTextToDisplayDelegate(AddTextToChatDisplay);
                this.Invoke(d, Cont);//chỉ cho phép thread được truy cập
            }
            else
            {
                txtChatDisplay.AppendText(Cont + Environment.NewLine);
            }
        }
Example #2
0
 public void AddTextToDisplay(String Info)
 {
     if (this.InvokeRequired)
     {
         AddTextToDisplayDelegate d = new AddTextToDisplayDelegate(AddTextToDisplay);
         this.Invoke(d, Info);
     }
     else
     {
         this.txtDisplay.AppendText(Environment.NewLine + "#" + Info);
     }
 }
Example #3
0
 private void AddTextToChatDisplay(String Cont)
 {
     if (this.InvokeRequired)
     {
         AddTextToDisplayDelegate d = new AddTextToDisplayDelegate(AddTextToChatDisplay);
         this.Invoke(d, Cont);
     }
     else
     {
         txtChatDisplay.AppendText(Cont + Environment.NewLine);
     }
 }