/// <summary> /// Set a new visual /// </summary> public void SetNewGraphicPath(GraphicPath path) { if (path == null) { Preview = null; } var geometry = GeometryBinaryGenerator.GenerateGeometry(path.Geometry); Preview = geometry; UpdatePreviewAll(); }
/// <summary> /// Update all code generators /// </summary> private void UpdateAll() { if (StreamCode == null || DrawingBrushCode == null || Preview == null) { return; } var path = selectedPath; if (path == null) { Preview.Data = null; StreamCode.Text = string.Empty; DrawingBrushCode.Text = string.Empty; GeometryCode.Text = string.Empty; return; } if (NormalizeCheckBox.IsChecked == true) { var normalizer = new NormalizeVisual(); path = (GraphicPath)normalizer.Normalize(selectedPath, NormalizeAspect.Both, 100); } var xamlStream = StreamSourceGenerator.GeneratePath(path); StreamCode.Text = xamlStream; var drawingBrushSource = DrawingBrushSourceGenerator.Generate(path); DrawingBrushCode.Text = drawingBrushSource; var geometry = GeometryBinaryGenerator.GenerateGeometry(path.Geometry); Preview.Data = geometry; UpdatePreviewAll(); UpdateGeometrySourceCode(); }