Esempio n. 1
0
 public override void Visit(ExportContainer exportContainer)
 {
     sectionCanvas      = FixedDocumentCreator.CreateContainer(exportContainer);
     sectionCanvas.Name = exportContainer.Name;
     CanvasHelper.SetPosition(sectionCanvas, new Point(exportContainer.Location.X, exportContainer.Location.Y));
     PerformList(sectionCanvas, exportContainer.ExportedItems);
 }
        public override void Visit(ExportRectangle exportRectangle)
        {
            Canvas containerCanvas = FixedDocumentCreator.CreateContainer(exportRectangle);
            Canvas elementCanvas   = null;
            var    border          = CreateBorder(exportRectangle);

            border.CornerRadius = new CornerRadius(Convert.ToDouble(exportRectangle.CornerRadius));

            CanvasHelper.SetPosition(border, new Point(0, 0));

            foreach (var element in exportRectangle.ExportedItems)
            {
                if (IsGraphicsContainer(element))
                {
                    elementCanvas = RenderGraphicsContainer(element);
                    containerCanvas.Children.Add(elementCanvas);
                }
                else
                {
                    AsAcceptor(element).Accept(this);
                    containerCanvas.Children.Add(UIElement);
                }
                containerCanvas.UpdateLayout();
            }

            border.Child = containerCanvas;
            UIElement    = border;
        }
        Canvas RenderGraphicsContainer(IExportColumn column)
        {
            var graphicsContainer = column as GraphicsContainer;
            var graphCanvas       = FixedDocumentCreator.CreateContainer(graphicsContainer);

            CanvasHelper.SetPosition(graphCanvas, column.Location.ToWpf());
            graphCanvas.Background = FixedDocumentCreator.ConvertBrush(column.BackColor);

            if (graphicsContainer != null)
            {
                var rect = column as ExportRectangle;
                if (rect != null)
                {
                    Visit(rect);
                }

                var circle = column as ExportCircle;
                if (circle != null)
                {
                    Visit(circle);
                }
                graphCanvas.Children.Add(UIElement);
            }
            return(graphCanvas);
        }
Esempio n. 4
0
        public static Canvas CreateContainer(ExportContainer container)
        {
            var canvas = CreateCanvas(container);
            var size   = container.DesiredSize.ToWpf();

            CanvasHelper.SetPosition(canvas, new Point(container.Location.X, container.Location.Y));
            canvas.Measure(size);
            canvas.Arrange(new Rect(new Point(), size));
            canvas.UpdateLayout();
            return(canvas);
        }
Esempio n. 5
0
        public override void Visit(ExportRectangle exportRectangle)
        {
            var border = CreateBorder(exportRectangle);

            border.CornerRadius = new CornerRadius(Convert.ToDouble(exportRectangle.CornerRadius));
            CanvasHelper.SetPosition(border, new Point(0, 0));
            var containerCanvas = CreateItemsInContainer(exportRectangle.ExportedItems);

            border.Child = containerCanvas;
            UIElement    = border;
        }
Esempio n. 6
0
 void PerformList(Canvas myCanvas, System.Collections.Generic.List <IExportColumn> exportedItems)
 {
     foreach (var element in exportedItems)
     {
         var container = element as ExportContainer;
         if (container != null)
         {
             var containerCanvas = FixedDocumentCreator.CreateContainer(container);
             CanvasHelper.SetPosition(containerCanvas, new Point(container.Location.X, container.Location.Y));
             myCanvas.Children.Add(containerCanvas);
             PerformList(containerCanvas, container.ExportedItems);
         }
         else
         {
             var acceptor = element as IAcceptor;
             acceptor.Accept(this);
             myCanvas.Children.Add(UIElement);
         }
     }
 }