Exemplo n.º 1
0
 public void OnDataArrived(DataArrivedEventArgs e)
 {
     var handler = DataArrived;
     if (handler != null)
     {
         handler(this, e);
     }
 }
Exemplo n.º 2
0
 private void Instance_DataArrived(object sender, DataArrivedEventArgs e)
 {
     try
     {
         Console.WriteLine(@"{0}:数据接收", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss.fff"));
         textBoxResult.Invoke((MethodInvoker) delegate
         {
             string message = string.Format("{0}{1}{2}{1}{1}", e.ReturnData.DateTime.ToString("yyyy-MM-dd HH:mm:ss.fff"), Environment.NewLine, string.Join(",", e.ReturnData.DataList));
             textBoxResult.AppendText(message);
         });
     }
     catch (Exception ex)
     {
         BeginInvoke((Action) delegate
         {
             throw ex;
         });
     }
 }