Ejemplo n.º 1
0
 public async Task Notice(MessageType messageType, string title, string message, string username = null)
 {
     await Task.Run(() =>
     {
         var dyn = new
         {
             type = messageType.Description(),
             title,
             message
         };
         if (!string.IsNullOrWhiteSpace(username))
         {
             //Singlecast notice
             username = UserNameAdapter.Adapt(username);
             Logger.Info("send notice to " + username);
             Context.Clients.Group(username).addNoticeToPage(dyn);
         }
         else
         {
             //Multicast notice
             Logger.Info("multicast notice send");
             Context.Clients.All.addNoticeToPage(dyn);
         }
     });
 }