private void addColor(MakeXML xmlHolder, Ink ink, Shape.ShapeType type) { Shape[] shapes = new Shape[0]; switch (type) { case (Shape.ShapeType.LABELED): shapes = xmlHolder.getSketch().Labeled; break; case (Shape.ShapeType.CLUSTERED): shapes = xmlHolder.getSketch().Clustered; break; } foreach (Shape shape in shapes) { string name = shape.Name; Color c = getRandomColor(); foreach (Shape.Arg arg in shape.Args) { string guid = arg.Id; Shape toColor = (Shape)xmlHolder.getSketch().IdToShape[guid]; if (toColor != null) { string guid2 = toColor.Id; if (guidToMStroke.ContainsKey(guid2)) { ((Microsoft.Ink.Stroke)guidToMStroke[guid2]).DrawingAttributes.Color = c; } } } } }
/// <summary> /// Converts the XML format into Ink strokes and creates a mapping between the XML stroke Ids and the /// Ink stroke Ids. /// </summary> public MakeInk(MakeXML xmlHolder, Ink ink) { this.ink = ink; this.idToCStroke = this.getIdToCStroke(xmlHolder.getSketch(), this.ink); calculateIdToMStroke(); this.idToMSubstrokes = new Hashtable(); }
/// <summary> /// Converts the XML format into Ink strokes and creates a mapping between the XML stroke Ids and the /// Ink stroke Ids. /// </summary> public MakeInk(MakeXML xmlHolder, Ink ink, Shape.ShapeType type) { this.ink = ink; this.idToCStroke = this.getIdToCStroke(xmlHolder.getSketch(), this.ink); calculateIdToMStroke(); this.idToMSubstrokes = new Hashtable(); addColor(xmlHolder, ink, type); }