public IAsyncResult BeginSendDirectedMessage(AccountId userId, string language, string message, string applicationStanzaNamespace, string applicationStanzaBody, AsyncCallback callback) { if (AccountId.IsNullOrEmpty(userId)) { throw new ArgumentNullException(nameof(userId)); } if (string.IsNullOrEmpty(message) && string.IsNullOrEmpty(applicationStanzaBody)) { throw new ArgumentNullException($"{nameof(message)} and {nameof(applicationStanzaBody)} cannot both be null"); } AssertLoggedIn(); AsyncNoResult ar = new AsyncNoResult(callback); var request = new vx_req_account_send_message_t { account_handle = _accountHandle, message_body = message, user_uri = userId.ToString(), language = language, application_stanza_namespace = applicationStanzaNamespace, application_stanza_body = applicationStanzaBody }; VxClient.Instance.BeginIssueRequest(request, result => { vx_resp_account_send_message_t response; try { response = VxClient.Instance.EndIssueRequest(result); _directedMessageResult = new DirectedMessageResult(response.request_id); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(nameof(DirectedMessageResult))); ar.SetComplete(); } catch (Exception e) { VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}"); ar.SetComplete(e); return; } }); return(ar); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(vx_req_account_send_message_t obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }