Beispiel #1
0
 async void Holder_OnDataReceived(object sender, DataReceivedArgs e) {
     if (e.Data != null) {
         var msg = (BaseMessage)e.Data;
         if (msg != null) {
             var client = this.Clients.FirstOrDefault(c => c.Value.AcceptMessageType.Equals(msg.GetType()));
             if (client != null) {
                 try {
                     await client.Value.Send(msg);
                 } catch (Exception ex) {
                     this.Processed(this, new ProcessedArgs(msg.MsgType, msg.ID, ex));
                     Console.WriteLine(ex.Message);
                 }
             }
         }
     }
 }
Beispiel #2
0
 async void holder_OnDataReceived(object sender, DataReceivedArgs e) {
     var data = (ProcessedMsg)e.Data;
     this.StoredList.Add(data);
     await this.DetectSave();
 }