Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Commit

Permalink
sticker content
Browse files Browse the repository at this point in the history
  • Loading branch information
cherryymerryy committed Aug 26, 2024
1 parent 461d0ad commit b9b15d0
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 2 deletions.
8 changes: 6 additions & 2 deletions CherryMerryGramDesktop/Views/Chats/ChatEntry.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ private Task ProcessUpdates(TdApi.Update update)
// }
case TdApi.Update.UpdateChatTitle updateChatTitle:
{
TextBlockChatName.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Normal, () => TextBlockChatName.Text = updateChatTitle.Title);
TextBlockChatName.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.Normal,
() => TextBlockChatName.Text = updateChatTitle.Title);
break;
}
case TdApi.Update.UpdateChatPhoto:
Expand Down Expand Up @@ -134,13 +135,16 @@ private static string GetMessageText(long chatId, long messageId)
return messageText;
}

private async void Button_OnClick(object sender, RoutedEventArgs e)
private void Button_OnClick(object sender, RoutedEventArgs e)
{
if (ChatPage != null && _chatWidget != null && _chatWidget._chatId != ChatId)
{
ChatPage.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.High,
() => ChatPage.Children.Remove(_chatWidget));
_chatWidget = null;
ChatPage.DispatcherQueue.TryEnqueue(DispatcherQueuePriority.High,
() => ChatPage.Children.Remove(_chatWidget));
_chatWidget = null;
}

_chatWidget = new Chat
Expand Down
1 change: 1 addition & 0 deletions CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
<TextBlock x:Name="ReplyInputContent" TextWrapping="Wrap" />
</StackPanel>
</Border>
<Image x:Name="MessageSticker" />
<TextBlock x:Name="MessageContent" Text="messageContent" TextWrapping="Wrap" />
</StackPanel>
</Border>
Expand Down
22 changes: 22 additions & 0 deletions CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,28 @@ public async void UpdateMessage(TdApi.Message message)
_ => MessageContent.Text
};

switch (message.Content)
{
case TdApi.MessageContent.MessageText:
{
MessageContent.Visibility = Visibility.Visible;
MessageSticker.Visibility = Visibility.Collapsed;
break;
}
case TdApi.MessageContent.MessageSticker messageSticker:
{
MessageContent.Visibility = Visibility.Collapsed;
MessageSticker.Visibility = Visibility.Visible;
var stickerFile = await _client.ExecuteAsync(new TdApi.DownloadFile
{
FileId = messageSticker.Sticker.Sticker_.Id,
Priority = 1
});
MessageSticker.Source = new BitmapImage(new Uri(stickerFile.Local.Path));
break;
}
}

if (chat.Permissions.CanPinMessages)
{
ContextMenuPin.IsEnabled = false;
Expand Down

0 comments on commit b9b15d0

Please sign in to comment.