public IAsyncResult Disconnect(AsyncCallback callback = null) { AssertSessionNotDeleted(); AsyncNoResult ar = new AsyncNoResult(callback); if (AudioState == ConnectionState.Connecting || AudioState == ConnectionState.Connected || TextState == ConnectionState.Connecting || TextState == ConnectionState.Connected) { var request = new vx_req_sessiongroup_remove_session_t { session_handle = _sessionHandle, sessiongroup_handle = GroupId }; VxClient.Instance.BeginIssueRequest(request, result => { try { VxClient.Instance.EndIssueRequest(result); _loginSession.ClearTransmittingChannel(Channel); ar.SetComplete(); } catch (Exception e) { VivoxDebug.Instance.VxExceptionMessage($"{request.GetType().Name} failed: {e}"); ar.SetComplete(e); if (VivoxDebug.Instance.throwInternalExcepetions) { throw; } return; } // Don't set the media and text state since that needs to occur from // events or the client will not reflect what's happening on the server. }); if (AudioState != ConnectionState.Disconnected) { AudioState = ConnectionState.Disconnecting; } if (TextState != ConnectionState.Disconnected) { TextState = ConnectionState.Disconnecting; } if (ChannelState != ConnectionState.Disconnected) { ChannelState = ConnectionState.Disconnecting; } } return(ar); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(vx_req_sessiongroup_remove_session_t obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }