예제 #1
0
 public async virtual void SendMessage(string message, string recipient, byte[] groupId)
 {
     try
     {
         await Task.Run(async() => {
             if (groupId != null && groupId.Length > 0)
             {
                 string groupName = await GetGroupName(groupId);
                 Log.Write($"Sending group message with text '{message}' to group '{groupName}'");
                 _service.sendGroupMessage(message, new string[] { }, groupId);
             }
             else
             {
                 Log.Write($"Sending message with text '{message}' to '{recipient}'");
                 _service.sendMessage(message, new string[] { }, recipient);
             }
         });
     }
     catch (Exception e)
     {
         Log.Write($"{e.Message} | StackTrace: {e.StackTrace}", Log.LogLevel.ERROR);
     }
 }