Пример #1
0
        private void AppendText(ScrollViewer scroll, ChatMessage message, string servername = null)
        {
            var text = string.IsNullOrEmpty(servername)
                ?
                       $"[ {message.Date.UtcToLocalFromSettings():HH:mm:ss} ]  {message.Message}"
                :
                       $"[{servername}] [ {message.Date.UtcToLocalFromSettings():yyyy-MM-dd HH:mm:ss} ]  {message.Message}";

            var color = ServerMonitorChatViewModel.GetMessageColor(message);

            var p = new Paragraph
            {
                Foreground = new SolidColorBrush(color),
                FontSize   = 13
            };


            p.Inlines.Add(text);

            if (message.Type != ChatMessage.MessageType.RCon && IsImportantMessage(message))
            {
                p.FontWeight = FontWeights.Heavy;
            }

            msgBox.Document.Blocks.Add(p);

            if (IsAutoScroll)
            {
                scroll.ScrollToEnd();
            }
        }
Пример #2
0
        public void AppendText(ChatMessage message, string servername = null)
        {
            var text = string.IsNullOrEmpty(servername)
                ?
                       $"[ {message.Date.UtcToLocalFromSettings():HH:mm:ss} ]  {message.Message}\n"
                :
                       $"[{servername}] [ {message.Date.UtcToLocalFromSettings():yyyy-MM-dd HH:mm:ss} ]  {message.Message}\n";

            var color = ServerMonitorChatViewModel.GetMessageColor(message);

            Add(text, color, (message.Type != ChatMessage.MessageType.RCon) && IsImportantMessage(message));
        }
Пример #3
0
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            var message = value as FullChatMessage;

            if (message == null)
            {
                return(Brushes.Black);
            }


            var color = ServerMonitorChatViewModel.GetMessageColor(message.Message);
            var brush = new SolidColorBrush(color);

            return(brush);
        }
Пример #4
0
        public void AppendText(Paragraph p, ScrollViewer scroll, ChatMessage message, string servername)
        {
            var text = string.Format("[{0}] [ {1:yyyy-MM-dd HH:mm:ss} ]  {2}\n", servername, message.Date.UtcToLocalFromSettings(),
                                     message.Message);
            var color = ServerMonitorChatViewModel.GetMessageColor(message);
            var brush = new SolidColorBrush(color);
            var span  = new Span {
                Foreground = brush
            };

            if (message.Type != ChatMessage.MessageType.RCon && message.IsImportantMessage)
            {
                span.FontWeight = FontWeights.Heavy;
            }

            span.Inlines.Add(text);
            p.Inlines.Add(span);
        }
Пример #5
0
        public void AppendText(Paragraph p, ScrollViewer scroll, ChatMessage message)
        {
            var text  = $"[ {message.Date.UtcToLocalFromSettings():HH:mm:ss} ]  {message.Message}\n";
            var color = ServerMonitorChatViewModel.GetMessageColor(message);

            var brush = new SolidColorBrush(color);
            var span  = new Span {
                Foreground = brush
            };

            span.Inlines.Add(text);

            if (message.Type != ChatMessage.MessageType.RCon && message.IsImportantMessage)
            {
                span.FontWeight = FontWeights.Heavy;
            }

            _paragraph.Inlines.Add(span);

            if (Model.AutoScroll)
            {
                scroll.ScrollToEnd();
            }
        }