diff --git a/CherryMerryGramDesktop/Views/Chats/ChatEntry.xaml.cs b/CherryMerryGramDesktop/Views/Chats/ChatEntry.xaml.cs index 3ea9644..99380f3 100644 --- a/CherryMerryGramDesktop/Views/Chats/ChatEntry.xaml.cs +++ b/CherryMerryGramDesktop/Views/Chats/ChatEntry.xaml.cs @@ -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: @@ -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 diff --git a/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml b/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml index ff666c2..3b22535 100644 --- a/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml +++ b/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml @@ -39,6 +39,7 @@ + diff --git a/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml.cs b/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml.cs index b0cc857..3eae41a 100644 --- a/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml.cs +++ b/CherryMerryGramDesktop/Views/Chats/ChatMessage.xaml.cs @@ -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;