Ejemplo n.º 1
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="message">消息对象</param>
        public static void SendMessage(NIMIMMessage message, ReportUploadProgressDelegate action = null)
        {
            System.Diagnostics.Debug.Assert(message != null && !string.IsNullOrEmpty(message.ReceiverID));
            var    msg = message.Serialize();
            IntPtr ptr = IntPtr.Zero;

            if (action != null)
            {
                ptr = NimUtility.DelegateConverter.ConvertToIntPtr(action);
            }
            TalkNativeMethods.nim_talk_send_msg(msg, null, UploadFileProgressChanged, ptr);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 向群组强制推送消息
        /// </summary>
        /// <param name="message">消息对象</param>
        /// <param name="forceMsg">强制推送内容</param>
        /// <param name="action">文件类消息附件上传进度</param>
        public static void SendTeamFrocePushMessage(NIMIMMessage message, TeamForecePushMessage forceMsg, ReportUploadProgressDelegate action = null)
        {
            System.Diagnostics.Debug.Assert(message != null && message.SessionType == Session.NIMSessionType.kNIMSessionTypeTeam);
            var    msgJson = forceMsg.Serialize(message);
            IntPtr ptr     = IntPtr.Zero;

            if (action != null)
            {
                NimUploadProgressData data = new NimUploadProgressData();
                data.Message        = message;
                data.ProgressAction = action;
                ptr = NimUtility.DelegateConverter.ConvertToIntPtr(data);
            }
            TalkNativeMethods.nim_talk_send_msg(msgJson, null, _uploadFileProgressChanged, ptr);
        }