/// <summary> /// Parse and display the new input stream /// </summary> private void CreatePaths(string stream) { GraphicPath path; try { var streamGeometryParser = new StreamGeometryParser(); var graphicPathGeometry = streamGeometryParser.ParseGeometry(stream); path = new GraphicPath(); path.Geometry = graphicPathGeometry; path.FillBrush = new GraphicSolidColorBrush { Color = Color.FromRgb(128, 128, 128) }; ShowError = false; } catch { path = null; ShowError = true; } PreviewViewModel.SetNewGraphicPath(path); ResourceViewModel.SetNewGraphicVisual(path); XamlViewModel.SetNewGraphicVisual(path); CSharpViewModel.SetNewGraphicVisual(path); ExportViewModel.SetNewGraphicVisual(path); }
/// <summary> /// Prepare all data for the graphic path selection listbox /// </summary> void PrepSelectionList() { if (graphicVisual != null) { var previewIcons = new List <PreviewShapeViewModel>(); int index = 0; CreateShapeSelectionList(graphicVisual, previewIcons, ref index); PreviewShapes = previewIcons; if (previewIcons.Count > 0) { TriggerResetView.Fire(); ResourceViewModel.Reset(); XamlViewModel.Reset(); CSharpViewModel.Reset(); } SelectAllPreviewIcons(true); } else { PreviewShapes = null; PreviewViewModel.SetNewGraphicVisual(null); ResourceViewModel.SetNewGraphicVisual(null); XamlViewModel.SetNewGraphicVisual(null); CSharpViewModel.SetNewGraphicVisual(null); ExportViewModel.SetNewGraphicVisual(null); } }
/// <summary> /// Update all views with the new selection /// </summary> private void UpdateAll() { GraphicColorPrecision?colorPrecision = null; // get the selected paths selectedVisual = BuildSelectedDrawing(graphicVisual); if (selectedVisual != null) { colorPrecision = GetColorPrecision(selectedVisual); } PreviewViewModel.SetNewGraphicVisual(selectedVisual, colorPrecision); ResourceViewModel.SetNewGraphicVisual(selectedVisual, colorPrecision); XamlViewModel.SetNewGraphicVisual(selectedVisual, colorPrecision); CSharpViewModel.SetNewGraphicVisual(selectedVisual); ExportViewModel.SetNewGraphicVisual(selectedVisual); }