Exemplo n.º 1
0
        /// <summary>
        /// 取消发送消息,目前用于取消发送文件消息
        /// </summary>
        /// <param name="message">消息体</param>
        /// <param name="action">附件上传进度回调</param>
        public static void StopSendMessage(NIMIMMessage message, ReportUploadProgressDelegate action = null)
        {
            System.Diagnostics.Debug.Assert(message != null);
            var    msg = message.Serialize();
            IntPtr ptr = IntPtr.Zero;

            if (action != null)
            {
                ptr = NimUtility.DelegateConverter.ConvertToIntPtr(action);
            }
            TalkNativeMethods.nim_talk_stop_send_msg(msg, null, UploadFileProgressChanged, ptr);
        }
Exemplo n.º 2
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);
            }
            System.Diagnostics.Debug.WriteLine("send message:" + msg);
            TalkNativeMethods.nim_talk_send_msg(msg, null, UploadFileProgressChanged, ptr);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 取消发送消息,目前用于取消发送文件消息
        /// </summary>
        /// <param name="message">消息体</param>
        /// <param name="action">附件上传进度回调</param>
        public static void StopSendMessage(NIMIMMessage message, ReportUploadProgressDelegate action = null)
        {
            var    msg = message.Serialize();
            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_stop_send_msg(msg, null);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 发送消息
        /// </summary>
        /// <param name="message">消息对象</param>
        /// <param name="action">文件类消息附件上传进度</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)
            {
                NimUploadProgressData data = new NimUploadProgressData();
                data.Message        = message;
                data.ProgressAction = action;
                ptr = NimUtility.DelegateConverter.ConvertToIntPtr(data);
            }
            TalkNativeMethods.nim_talk_send_msg(msg, null, _uploadFileProgressChanged, ptr);
        }
Exemplo n.º 5
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);
        }