Beispiel #1
0
        private List <IShape> LoadDrawnShapes(XmlNode drawnShapesNode)
        {
            var drawnShapes = new List <IShape>();

            foreach (XmlNode node in drawnShapesNode.ChildNodes)
            {
                IShape shape = null;
                switch (node.Name)
                {
                case "CIRCLE":
                    shape = new Circle();
                    break;

                case "RECTANGLE":
                    shape = new Rectangle();
                    break;

                case "GROUP":
                    shape = new GroupShapes();
                    break;

                default:
                    break;
                }
                if (shape != null)
                {
                    shape.XmlToShape(node);
                    drawnShapes.Add(shape);
                }
            }

            return(drawnShapes);
        }
Beispiel #2
0
        public ToolBar LoadToolBar(XmlNode toolbarNode)
        {
            var toolbar = new ToolBar();

            foreach (XmlNode node  in toolbarNode.ChildNodes)
            {
                IShape shape = null;
                switch (node.Name)
                {
                case "CIRCLE":
                    shape = new Circle();
                    break;

                case "RECTANGLE":
                    shape = new Rectangle();
                    break;

                case "GROUP":
                    shape = new GroupShapes();
                    break;
                }
                if (shape != null)
                {
                    shape.XmlToShape(node);
                    toolbar.Add(shape);
                }
            }

            return(toolbar);
        }