Ejemplo n.º 1
0
        public void UpdateMessageInteractionInfo(MessageViewModel message)
        {
            if (message.InteractionInfo?.ReplyInfo?.ReplyCount > 0 && !message.IsChannelPost)
            {
                RepliesGlyph.Text = "\uE93E\u00A0\u00A0";
                RepliesLabel.Text = $"{message.InteractionInfo.ReplyInfo.ReplyCount}   ";
            }
            else
            {
                RepliesGlyph.Text = string.Empty;
                RepliesLabel.Text = string.Empty;
            }

            var views = string.Empty;

            if (message.InteractionInfo?.ViewCount > 0)
            {
                views  = BindConvert.ShortNumber(message.InteractionInfo.ViewCount);
                views += "   ";
            }

            if (message.IsChannelPost && !string.IsNullOrEmpty(message.AuthorSignature))
            {
                views += $"{message.AuthorSignature}, ";
            }
            else if (message.ForwardInfo?.Origin is MessageForwardOriginChannel fromChannel && !string.IsNullOrEmpty(fromChannel.AuthorSignature))
            {
                views += $"{fromChannel.AuthorSignature}, ";
            }

            ViewsGlyph.Text = message.InteractionInfo?.ViewCount > 0 ? "\uE607\u00A0\u00A0" : string.Empty;
            ViewsLabel.Text = views;
        }
Ejemplo n.º 2
0
        public void ConvertViews(MessageViewModel message)
        {
            var number = string.Empty;

            if (message.Views > 0)
            {
                number  = BindConvert.ShortNumber(Math.Max(message.Views, 1));
                number += "   ";
            }

            if (message.IsChannelPost && !string.IsNullOrEmpty(message.AuthorSignature))
            {
                number += $"{message.AuthorSignature}, ";
            }
            else if (message.ForwardInfo?.Origin is MessageForwardOriginChannel forwardedPost && !string.IsNullOrEmpty(forwardedPost.AuthorSignature))
            {
                number += $"{forwardedPost.AuthorSignature}, ";
            }

            ViewsGlyph.Text = message.Views > 0 ? "\uE607\u00A0\u00A0" : string.Empty;
            ViewsLabel.Text = number;
        }