public Task <ReturnMessage> SendUiMessage(int messageId, string pData, int dataLength, string targetPhoneId) { Task <ReturnMessage> checkTask = _meetingManager.CheckMeetingServerStatus(); if (checkTask != null) { return(checkTask); } var tcs = new TaskCallback <ReturnMessage>("SendUIMessage"); if (_meetingManager.TaskCallbacks.ContainsKey(tcs.Name)) { _meetingManager.TaskCallbacks.Remove(tcs.Name); } _meetingManager.TaskCallbacks.Add(tcs.Name, tcs); int result = MeetingAgent.SendUIMessage(messageId, pData, dataLength, targetPhoneId); if (result != 0) { return(Task.FromResult(MessageManager.FailedToSendUiMessage)); } return(tcs.Task); }