예제 #1
0
        public static void UpdateNodeShape(node n)
        {
            string        strShape;
            List <string> shapeData;

            if (n.DisplayShape == null)
            {
                shapeData = new List <string>();
            }
            else
            {
                shapeData
                    = new List <string>(n.DisplayShape.ToString().Split(new[] { ',', '.' }));
            }
            if (shapeData.Count == 0)
            {
                strShape = updateNodeShapeKeyString("");
            }
            else
            {
                strShape = updateNodeShapeKeyString(shapeData[0]);
            }
            if (shapeData.Count > 1)
            {
                MyXamlHelpers.SetValue(ref strShape, "Fill",
                                       BrushSelector.GetColorFromString(shapeData[1]).ToString());
                MyXamlHelpers.SetValue(ref strShape, "Width", shapeData[2]);
                MyXamlHelpers.SetValue(ref strShape, "Height", shapeData[3]);
            }
            MyXamlHelpers.SetValue(ref strShape, "Tag", n.name);
            n.DisplayShape = new DisplayShape(strShape, ShapeRepresents.Node, n);
        }
예제 #2
0
        public static void UpdateArcShape(arc a)
        {
            string strShape;
            var    shapeData = new List <string>();

            if (a.DisplayShape != null)
            {
                shapeData = new List <string>(a.DisplayShape.ToString().Split(new[] { ',', '.' }));
            }
            if (shapeData.Count == 0)
            {
                strShape = updateArcShapeKeyString("");
            }
            else
            {
                strShape = updateArcShapeKeyString(shapeData[0]);
            }
            if (shapeData.Count > 1)
            {
                MyXamlHelpers.SetValue(ref strShape, "Stroke",
                                       BrushSelector.GetColorFromString(shapeData[1]).ToString());
                MyXamlHelpers.SetValue(ref strShape, "StrokeThickness", shapeData[2]);
            }
            MyXamlHelpers.SetValue(ref strShape, "Tag", a.name);
            a.DisplayShape = new DisplayShape(strShape, ShapeRepresents.Arc, a);
        }