private static Section CreateUICtrlMsg(UIControlMessage uiControlMsg)
        {
            Section   section  = new Section();
            string    iconPath = uiControlMsg.IconPath;
            Paragraph item     = new Paragraph
            {
                Foreground = Brushes.DimGray
            };
            Paragraph paragraph2 = new Paragraph
            {
                Margin = new Thickness(19.0, 0.0, 0.0, 0.0)
            };

            if (!string.IsNullOrEmpty(iconPath))
            {
                Image uiElement = new Image
                {
                    Width  = 16.0,
                    Height = 16.0,
                    HorizontalAlignment = HorizontalAlignment.Left,
                    VerticalAlignment   = VerticalAlignment.Top,
                    Stretch             = Stretch.None,
                    SnapsToDevicePixels = true,
                    Source = new BitmapImage(new Uri(iconPath, UriKind.RelativeOrAbsolute))
                };
                item.Inlines.Add(uiElement);
                item.Inlines.Add(uiControlMsg.Title);
                section.Blocks.Add(item);
            }
            UIElement uIControl = uiControlMsg.UIControl;

            paragraph2.Inlines.Add(uIControl);
            section.Blocks.Add(paragraph2);
            return(section);
        }
 public void OnNotifyMessage(Message message)
 {
     if (message.Type == InstanceAnswerPro.Core.MessageType.UIControlMessage)
     {
         UIControlMessage uiControlMsg = message as UIControlMessage;
         if (((this.CurrentIMSession != null) && (uiControlMsg.Uin == this.CurrentIMSession.Buddy.Uin)) && ("ContactSessionWindow" == (uiControlMsg.Parameter as string)))
         {
             Section item = CreateUICtrlMsg(uiControlMsg);
             //if (this.OutputBox.Document.Blocks.FirstBlock == null)
             //{
             //    this.OutputBox.Document.Blocks.Add(item);
             //}
             //else
             //{
             //    this.OutputBox.Document.Blocks.InsertBefore(this.OutputBox.Document.Blocks.FirstBlock, item);
             //}
             //this.OutputBox.ScrollToEnd();
         }
     }
 }
 private static Section CreateUICtrlMsg(UIControlMessage uiControlMsg)
 {
     Section section = new Section();
     string iconPath = uiControlMsg.IconPath;
     Paragraph item = new Paragraph
     {
         Foreground = Brushes.DimGray
     };
     Paragraph paragraph2 = new Paragraph
     {
         Margin = new Thickness(19.0, 0.0, 0.0, 0.0)
     };
     if (!string.IsNullOrEmpty(iconPath))
     {
         Image uiElement = new Image
         {
             Width = 16.0,
             Height = 16.0,
             HorizontalAlignment = HorizontalAlignment.Left,
             VerticalAlignment = VerticalAlignment.Top,
             Stretch = Stretch.None,
             SnapsToDevicePixels = true,
             Source = new BitmapImage(new Uri(iconPath, UriKind.RelativeOrAbsolute))
         };
         item.Inlines.Add(uiElement);
         item.Inlines.Add(uiControlMsg.Title);
         section.Blocks.Add(item);
     }
     UIElement uIControl = uiControlMsg.UIControl;
     paragraph2.Inlines.Add(uIControl);
     section.Blocks.Add(paragraph2);
     return section;
 }