Esempio n. 1
0
 private async Task ListenAsync(IAsyncStreamReader <MessageModel> stream, CancellationToken token)
 {
     try
     {
         await foreach (var m in stream.AsAsyncEnumerable(token))
         {
             Messages.Add(new Message(m.User, m.Text, m.Time.ToDateTime()));
         }
     }
     catch (RpcException e) when(e.StatusCode == StatusCode.Cancelled)
     {
         return;
     }
     catch (OperationCanceledException)
     {
         return;
     }
 }
Esempio n. 2
0
 private async Task ListenUserlistAsync(IAsyncStreamReader <Userlist> stream, CancellationToken token)
 {
     try
     {
         await foreach (var e in stream.AsAsyncEnumerable(token))
         {
             Userlist = e.User.ToUserString();
         }
     }
     catch (RpcException e) when(e.StatusCode == StatusCode.Cancelled)
     {
         return;
     }
     catch (OperationCanceledException)
     {
         return;
     }
 }