Esempio n. 1
0
 public async Task SendCommand <T>(T data)
 {
     try {
         var line = CommandJsonSerializer.SerializeToLine(data);
         await SendString(line);
     } catch (Exception ex) {
         Trace.TraceError("Error sending {0} : {1}", data, ex);
     }
 }
Esempio n. 2
0
 public override async Task OnLineReceived(string line)
 {
     try {
         dynamic obj = CommandJsonSerializer.DeserializeLine(line);
         await Process(obj);
     } catch (Exception ex) {
         Trace.TraceError("Error processing line {0} : {1}", line, ex);
     }
 }
Esempio n. 3
0
 public override async Task OnLineReceived(string line)
 {
     try {
         dynamic obj = CommandJsonSerializer.DeserializeLine(line);
         await(Task) Process(obj); //explicit specify as Task<> to fix "GetAwaiter() not defined". Reference: http://stackoverflow.com/questions/11853812/task-does-not-contain-a-definition-for-getawaiter
     } catch (Exception ex) {
         Trace.TraceError("Error processing line {0} : {1}", line, ex);
     }
 }
Esempio n. 4
0
 public async Task SendCommand <T>(T data)
 {
     try {
         var line = CommandJsonSerializer.SerializeToLine(data);
         Output(this, line);
         await transport.SendLine(line);
     } catch (Exception ex) {
         Trace.TraceError("Error sending {0} : {1}", data, ex);
     }
 }