Beispiel #1
0
 protected void OnDataReceived(DataTransEventArgs e)
 {
     if (DataReceived != null && IsOpened)
     {
         DataReceived(this, e);
     }
 }
 protected void OnDataSended(DataTransEventArgs e)
 {
     if (DataSended != null)
     {
         DataSended(this, e);
     }
 }
Beispiel #3
0
        protected void OnDataReceived(DataTransEventArgs e)
        {
            EventHandler <DataTransEventArgs> handler = DataReceived;

            if (handler != null)
            {
                handler(this, e);
            }
        }
 void udp_DataReceived(object sender, DataTransEventArgs e)
 {
     if (InvokeRequired)
     {
         Invoke(new EventHandler <DataTransEventArgs>(udp_DataReceived), new object[] { sender, e });
     }
     else
     {
         textBoxReceived.Text += string.Format("{0}:{1}\t{2}\r\n", e.IP, e.Port, e.Message);
     }
 }
 /// <summary>
 /// 连接发送数据处理
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void connection_DataSended(object sender, DataTransEventArgs e)
 {
     if (InvokeRequired)
     {
         Invoke(new EventHandler <DataTransEventArgs>(connection_DataSended), new object[] { sender, e });
     }
     else
     {
         dataShow.Add("发", (checkBoxBS.Checked ? ByteString.GetByteString(e.Data) : e.Message.Replace("\r", "\\r")));
     }
 }