Esempio n. 1
0
        internal static Paragraph AppendMessage(string MessageString)
        {
            string Sender  = "Sender";
            string Message = "Message";

            try
            {
                Sender  = AuxiliaryClientWorker.GetElement(MessageString, "-U ", " -Content");
                Message = AuxiliaryClientWorker.GetElement(MessageString, "-Content ", ";");
            }
            catch (Exception exc)
            {
                Console.WriteLine("Could not grab message information due to " + exc);
            }
            Paragraph ChatParagraph = new Paragraph();

            #region Profile picture before the text
            System.Windows.Shapes.Ellipse ImageToShowFrame = new System.Windows.Shapes.Ellipse();
            ImageToShowFrame.Height          = 30;
            ImageToShowFrame.Width           = 30;
            ImageToShowFrame.Stroke          = Brushes.Black;
            ImageToShowFrame.StrokeThickness = 1.5;
            ImageBrush ImageToShowBrush = new ImageBrush(AuxiliaryClientWorker.GetBitmapImageFromBitmap(MainClientWorker.CurrentProfilePictures[MainClientWorker.CurrentOnlineUsers.IndexOf(Sender)]));
            ImageToShowFrame.Fill = ImageToShowBrush;
            ImageToShowFrame.MouseLeftButtonDown += Placeholder;
            #endregion
            ChatParagraph.Inlines.Add(ImageToShowFrame);

            #region Text to add after the profile picture
            Label TextToShow = new Label();
            TextToShow.FontSize   = 16;
            TextToShow.Foreground = Brushes.Black;
            TextToShow.Content    = "[" + Sender + "]: " + Message;
            #endregion
            ChatParagraph.Inlines.Add(TextToShow);
            ChatParagraph.Inlines.Add(Environment.NewLine);
            return(ChatParagraph);
        }