/// <summary> /// Update the resource source code /// </summary> private void UpdateSourceCode() { var path = selectedVisual; if (path == null) { SourceCode = string.Empty; return; } if (Normalize) { var normalizer = new NormalizeVisual(); path = normalizer.Normalize(selectedVisual, NormalizeAspect.Both, 100); } switch (SelectedGeometryTypeItem.GeometryGeneratorType) { case ResourceGeometryGeneratorType.Stream: { var streams = StreamSourceGenerator.GenerateStreamGeometries(path); SourceCode = string.Join("\n", streams); break; } case ResourceGeometryGeneratorType.Geometry: { SourceCode = GeometrySourceGenerator.GenerateGeometry(path); break; } case ResourceGeometryGeneratorType.PathGeometry: { SourceCode = PathGeometrySourceGenerator.GeneratePathGeometry(path); break; } } }
/// <summary> /// Update the geometry source code /// </summary> private void UpdateGeometrySourceCode() { if (selectedVisual == null || ParameterComboBox == null) { return; } GeometrySourceGenerator geometrySourceGenerator; if (CreationComboBox.SelectedIndex == 0) { geometrySourceGenerator = new StreamGeometrySourceGenerator(); } else { geometrySourceGenerator = new PathGeometrySourceGenerator(); } geometrySourceGenerator.Filename = filename; geometrySourceGenerator.IncludeOffset = AddLeftTopCheckBox.IsChecked == true; if (ParameterComboBox.SelectedIndex == 0) { geometrySourceGenerator.NormalizeAspect = NormalizeGeometrySourceAspect.Height; } else if (ParameterComboBox.SelectedIndex == 1) { geometrySourceGenerator.NormalizeAspect = NormalizeGeometrySourceAspect.Width; } else { geometrySourceGenerator.NormalizeAspect = NormalizeGeometrySourceAspect.Individual; } GeometryCode.Text = geometrySourceGenerator.GenerateSource(selectedVisual); }