Ejemplo n.º 1
0
        /// <summary>
        /// Method that create objects to display the received and send messages
        /// </summary>
        /// <param name="message"></param>
        /// <param name="received">If true assumes the message was received from the websocket and align the message to the left</param>
        private void UpdateMessageHistory(string message, bool received)
        {
            var labelMessage = new Label();

            labelMessage.Content = message;
            if (received)
            {
                labelMessage.HorizontalContentAlignment = HorizontalAlignment.Left;
            }
            else
            {
                labelMessage.HorizontalContentAlignment = HorizontalAlignment.Right;
            }
            MessagesPanel.Children.Add(labelMessage);
            MessagesScrollBar.ScrollToEnd();
        }
Ejemplo n.º 2
0
        private void UpdateMessageHistory(byte[] imageByteArray, bool received)
        {
            var image = new Image();

            image.Source   = (ImageSource) new ImageSourceConverter().ConvertFrom(imageByteArray);
            image.MaxWidth = 300;
            if (received)
            {
                image.HorizontalAlignment = HorizontalAlignment.Left;
            }
            else
            {
                image.HorizontalAlignment = HorizontalAlignment.Right;
            }
            MessagesPanel.Children.Add(image);
            MessagesScrollBar.ScrollToEnd();
        }