private async void SendSticker(VkStickerProduct sticker) { var newMessage = new Message(new VkMessage() { IsOut = true, Date = DateTime.Now }, ViewModelLocator.Main.CurrentUser); newMessage.IsNew = true; try { newMessage.IsSent = false; newMessage.MessageContent.Attachments = new List <VkAttachment>() { new VkStickerAttachment() { ProductId = sticker.Id, Width = 200, Height = 200, Photo256 = sticker.GetPreviewUrl(256) } }; bool isChat = Dialog.Message.ChatId != 0; Messages.Add(newMessage); _lastSentMessages.Add(newMessage); var newMessageId = await ServiceLocator.Vkontakte.Messages.Send(!isChat?Dialog.User.Profile.Id : 0, isChat?Dialog.Message.ChatId : 0, null, stickerId : sticker.Id); newMessage.MessageContent.Id = newMessageId; newMessage.IsSent = true; _lastSentMessages.Remove(newMessage); } catch (Exception ex) { Logger.Error(ex, "Unable to send sticker message"); newMessage.IsFailed = true; } }
private void ChatSmilesControl_OnStickerChoosenEvent(object sender, VkStickerProduct sticker) { EmojiFlyout.Hide(); ((ConversationViewModel)DataContext).SendStickerCommand.Execute(sticker); }