public static void SaveChatAttachment(List <AttachmentViewModel> lstattachment, long contactId, long messageId)
        {
            var db = new SQLiteConnection(CommonConstant.DBPath);

            try
            {
                ChatAttachment chatAttachment = null;
                foreach (var cMsgAttachment in lstattachment)
                {
                    chatAttachment               = new ChatAttachment();
                    chatAttachment.url           = cMsgAttachment.Url;
                    chatAttachment.type          = cMsgAttachment.Type;
                    chatAttachment.chatMessageId = messageId;
                    chatAttachment.contactId     = contactId;
                    chatAttachment.UserId        = CommonHelper.GetUserId();
                    db.Insert(chatAttachment);
                    db.Commit();
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message, ex);
            }
            db.Close();
        }
Пример #2
0
        public void Setup(ChatMessage message, ChatAttachment attachment)
        {
            itemData     = resourceService.GetInventoryItemData((InventoryItemType)attachment.item_type, attachment.id);
            this.message = message;
            this.sender  = message.GetSender();

            if (itemData != null)
            {
                iconImage.overrideSprite = resourceService.GetSprite(itemData);
                nameText.text            = resourceService.GetString(itemData.nameId);
                giftButton.SetListener(() => {
                    netService.SendGift(new Gift(netService.LocalPlayer, sender, itemData));
                }, engine.GetService <IAudioService>());

                UpdateIconImage(sender, itemData);
                UpdateGiftButtonState(sender, itemData);
            }
        }