Пример #1
0
        /// <summary>
        /// Sends an attachemnt to another user.
        /// </summary>
        /// <param name="attachment">Attachment</param>
        /// <returns></returns>
        public void SendAttachemnt(AttachmentTag attachment)
        {
            var extraParams = new ExtraParams();

            extraParams.AddNew(ExtraParamsList.save_to_history, "1");
            extraParams.AddNew(ExtraParamsList.dialog_id, dialogId);
            extraParams.Add(attachment);

            quickbloxClient.ChatXmppClient.SendMessage(groupJid, "Attachment", extraParams, dialogId, null, MessageType.Groupchat);
        }
        private void SendAttachment(BlobUploadInfo blobUploadInfo)
        {
            if (string.IsNullOrEmpty(blobUploadInfo.UId))
                return;

            var attachment = new AttachmentTag
            {
                Id = blobUploadInfo.UId,
                Type = "image"
            };

            groupChatManager.SendAttachemnt(attachment);
        }
        private async Task SendAttachment(BlobUploadInfo blobUploadInfo, string imageUrl)
        {
            if (string.IsNullOrEmpty(blobUploadInfo.UId))
                return;

            var attachment = new AttachmentTag
            {
                Id = blobUploadInfo.UId,
                Type = "image"
            };

            privateChatManager.SendAttachemnt(attachment);

            var messageViewModel = new MessageViewModel()
            {
                AttachedImage = new BitmapImage(new Uri(imageUrl)),
                MessageType = MessageType.Outgoing,
                DateTime = DateTime.Now
            };

            await MessageCollectionViewModel.AddNewMessage(messageViewModel);
            var dialogsManager = ServiceLocator.Locator.Get<IDialogsManager>();
            await dialogsManager.UpdateDialogLastMessage(dialog.Id, "Attachment", DateTime.Now);
        }