Exemple #1
0
        /// <summary>
        /// 独立信令 离开频道接口
        /// </summary>
        /// <param name="param">离开频道的传入参数</param>
        /// <param name="cb">结果回调见NimSignalingDef.cs</param>
        public static void Leave(NIMSignalingLeaveParam param, NimSignalingOptCloseOrLeaveHandler cb)
        {
            NIMSignalingLeaveParam_C param_c = SignalHelper.GetNativeNIMSignalingLeaveParam(param);
            int    nSizeOfParam = Marshal.SizeOf(param_c);
            IntPtr param_ptr    = Marshal.AllocHGlobal(nSizeOfParam);

            try
            {
                Marshal.StructureToPtr(param_c, param_ptr, false);
                var user_ptr = NimUtility.DelegateConverter.ConvertToIntPtr(cb);
                SignalingNativeMethods.nim_signaling_leave(param_ptr, NimSignalingLeaveCb, user_ptr);
            }
            catch (Exception ex)
            {
            }
            finally
            {
                Marshal.FreeHGlobal(param_ptr);
            }
        }