public void DrawClass(string name, List <string> properties, List <string> methods)
        {
            StylusPointCollection stylusPoints = new StylusPointCollection();

            stylusPoints.Add(new StylusPoint(10, 10));
            ClassStroke classStroke = new ClassStroke(stylusPoints);

            classStroke.name       = name;
            classStroke.attributes = properties;
            classStroke.methods    = methods;

            InkCanvasStrokeCollectedEventArgs eventArgs = new InkCanvasStrokeCollectedEventArgs(classStroke);

            DrawingService.AddClassFromCode(eventArgs);

            DrawingService.CreateShape(classStroke);
        }
Example #2
0
        // On retire le trait du dessus de la pile de traits retirés et on le place sur la surface de dessin.
        public void Depiler(object o)
        {
            try
            {
                isStackUpToDate = false;
                CustomStroke trait = (CustomStroke)traitsRetires.Last();

                if (trait.isLinkStroke())
                {
                    LinkStroke linkStroke = trait as LinkStroke;

                    linkStroke.from.SetDefaults();
                    linkStroke.to.SetDefaults();
                }
                else
                {
                    ShapeStroke shapeStroke = trait as ShapeStroke;
                    shapeStroke.linksTo   = new List <string> {
                    };
                    shapeStroke.linksFrom = new List <string> {
                    };
                }

                traits.Add(trait);
                if (trait.isLinkStroke())
                {
                    DrawingService.CreateLink(trait as LinkStroke);
                }
                else
                {
                    DrawingService.CreateShape(trait as ShapeStroke);
                }
                traitsRetires.Remove(trait);
            }
            catch { }
        }