private void LoadMetroIcon(string key, Brush iconColor = null, double rotation = 0, double scaleIcon = 1)
        {
            if (string.IsNullOrEmpty(key))
            {
                return;
            }
            if (iconColor == null)
            {
                iconColor = new SolidColorBrush(Windows.UI.Colors.Purple);
            }
            _normalIconColor = iconColor;

            string temp      = (string)Application.Current.Resources[key];
            string pthString = @"<Path xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" 
                Data=""" + temp + @""" />";

            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)Windows.UI.Xaml.Markup.XamlReader.Load(pthString);
            pth.Stretch = Stretch.Uniform;
            pth.Fill    = iconColor;
            pth.Width   = 25;
            pth.Height  = 25;


            grdIconImage.Children.Add(pth);

            ((CompositeTransform)grdIconImage.RenderTransform).Rotation = rotation;
            ((CompositeTransform)grdIconImage.RenderTransform).ScaleX   = scaleIcon;
            ((CompositeTransform)grdIconImage.RenderTransform).ScaleY   = scaleIcon;
        }
Exemple #2
0
        // throws ArgumentException if pointerPoint.pointerId is already in live rendering mode
        public void EnterLiveRendering(Windows.UI.Input.PointerPoint pointerPoint, Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes)
        {
            uint pointerId = pointerPoint.PointerId;

            // Create and initialize the data structures necessary to render a polyline in XAML.
            var stroke = new Windows.UI.Xaml.Media.PolyLineSegment();

            stroke.Points.Add(pointerPoint.Position);
            var figure = new Windows.UI.Xaml.Media.PathFigure();

            figure.StartPoint = pointerPoint.Position;
            figure.Segments.Add(stroke);
            var geometry = new Windows.UI.Xaml.Media.PathGeometry();

            geometry.Figures.Add(figure);
            var path = new Windows.UI.Xaml.Shapes.Path();

            path.Data = geometry;

            // Set the stroke's graphical properties, which are controlled by the Path object
            path.Stroke             = new Windows.UI.Xaml.Media.SolidColorBrush(drawingAttributes.Color);
            path.StrokeThickness    = drawingAttributes.Size.Width;
            path.StrokeLineJoin     = Windows.UI.Xaml.Media.PenLineJoin.Round;
            path.StrokeStartLineCap = Windows.UI.Xaml.Media.PenLineCap.Round;

            // Update dictionaries
            liveStrokes.Add(pointerId, stroke); // throws ArgumentException if pointerId is already in the dictionary
            livePaths.Add(pointerId, path);     // throws ArgumentException if pointerId is already in the dictionary

            // Add path to render so that it is rendered (on top of all the elements with same ZIndex).
            // We want the live render to be on top of the Bezier render, so we set the ZIndex of the elements of the
            // live render to 2 and that of the elements of the Bezier render to 1.
            render.Children.Add(path);
            Windows.UI.Xaml.Controls.Canvas.SetZIndex(path, 2);
        }
Exemple #3
0
 internal void CreateNodeBoundaryPath()
 {
     if (FrameworkElementOfNodeForLabel != null)
     {
         var center = Node.GeometryNode.Center;
         var margin = 2 * Node.Attr.LabelMargin;
         var bc     = NodeBoundaryCurves.GetNodeBoundaryCurve(Node,
                                                              FrameworkElementOfNodeForLabel
                                                              .Width + margin,
                                                              FrameworkElementOfNodeForLabel
                                                              .Height + margin);
         bc.Translate(center);
     }
     BoundaryPath = new Path {
         Data = CreatePathFromNodeBoundary(), Tag = this
     };
     Panel.SetZIndex(BoundaryPath, ZIndex);
     SetFillAndStroke();
     if (Node.Label != null)
     {
         ToolTipService.SetToolTip(BoundaryPath, Node.LabelText);
         if (FrameworkElementOfNodeForLabel != null)
         {
             ToolTipService.SetToolTip(FrameworkElementOfNodeForLabel, Node.LabelText);
         }
     }
 }
Exemple #4
0
        public static Windows.UI.Xaml.Shapes.Path CreateBezierPath(Windows.UI.Input.Inking.InkStroke stroke)
        {
            // Create Bezier geometries using information provided by the stroke's segments
            var figure   = new Windows.UI.Xaml.Media.PathFigure();
            var segments = stroke.GetRenderingSegments().GetEnumerator();

            segments.MoveNext();
            // First segment is degenerate and corresponds to initial position
            figure.StartPoint = segments.Current.Position;
            // Now loop through all remaining segments
            while (segments.MoveNext())
            {
                var bs = new Windows.UI.Xaml.Media.BezierSegment();
                bs.Point1 = segments.Current.BezierControlPoint1;
                bs.Point2 = segments.Current.BezierControlPoint2;
                bs.Point3 = segments.Current.Position;
                figure.Segments.Add(bs);
            }

            // Create and initialize the data structures necessary to render the figure
            var geometry = new Windows.UI.Xaml.Media.PathGeometry();

            geometry.Figures.Add(figure);
            var path = new Windows.UI.Xaml.Shapes.Path();

            path.Data = geometry;

            // Set the stroke's graphical properties, which are controlled by the Path object
            path.Stroke             = new Windows.UI.Xaml.Media.SolidColorBrush(stroke.DrawingAttributes.Color);
            path.StrokeThickness    = stroke.DrawingAttributes.Size.Width;
            path.StrokeLineJoin     = Windows.UI.Xaml.Media.PenLineJoin.Round;
            path.StrokeStartLineCap = Windows.UI.Xaml.Media.PenLineCap.Round;

            return(path);
        }
        public void DeleteLine(String linename)
        {
            if (linename == null)
            {
                return;
            }
            if (m_FunctionLineModels.ContainsKey(linename))
            {
                Model.TrickerStarLineModel line = (TrickerStarLineModel)m_FunctionLineModels[linename];


                TrickerStarFunctionNodeModel node_from_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[line.From.NodeName];
                TrickerStarFunctionNodeModel node_to_m   = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[line.To.NodeName];


                node_from_m.OutputSlot[line.From.SlotIndex].LineName = null;
                node_to_m.InputSlot[line.To.SlotIndex].LineName      = null;
                m_FunctionNodeModels[line.From.NodeName]             = node_from_m;
                m_FunctionNodeModels[line.To.NodeName] = node_to_m;

                Windows.UI.Xaml.Shapes.Path t_path = m_FunctionLineViews[line.LineName] as Windows.UI.Xaml.Shapes.Path;
                C_MAIN_CANVAS.Children.Remove(t_path);

                m_FunctionLineModels.Remove(linename);
                m_FunctionLineViews.Remove(linename);
            }
            else
            {
            }
        }
Exemple #6
0
        void SetupCollapseSymbol()
        {
            var collapseBorderSize = GetCollapseBorderSymbolSize();

            Debug.Assert(collapseBorderSize > 0);
            _collapseButtonBorder = new Border {
                Background   = Common.BrushFromMsaglColor(_subgraph.CollapseButtonColorInactive),
                Width        = collapseBorderSize,
                Height       = collapseBorderSize,
                CornerRadius = new CornerRadius(collapseBorderSize / 2)
            };

            Panel.SetZIndex(_collapseButtonBorder, Panel.GetZIndex(BoundaryPath) + 1);


            var collapseButtonCenter = GetCollapseButtonCenter(collapseBorderSize);

            Common.PositionFrameworkElement(_collapseButtonBorder, collapseButtonCenter, 1);

            double w = collapseBorderSize * 0.4;

            _collapseSymbolPath = new Path {
                Data            = CreateCollapseSymbolPath(collapseButtonCenter + new Point(0, -w / 2), w),
                Stroke          = _collapseSymbolPathInactive,
                StrokeThickness = 1
            };

            Panel.SetZIndex(_collapseSymbolPath, Panel.GetZIndex(_collapseButtonBorder) + 1);
            _topMarginRect.PointerPressed += (s, e) =>
                                             TopMarginRectMouseLeftButtonDown(e);
        }
Exemple #7
0
        private void grdSubIcon_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            Grid selectedContainer = (Grid)sender;


            //UNSELECT PREVIOUS SELECTED ICON
            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)((ContentControl)selectedContainer.Children[0]).Content;

            if (currentlySelectedSubIconPath != null)
            {
                //unselect it
                currentlySelectedSubIconPath.Fill = TabLabelColor_Grey;

                if (currentlySelectedSubIconPath == pth)
                {
                    currentlySelectedSubIconPath = null;
                    return;
                }
            }


            //select it
            pth.Fill = TabLabelColor_White;
            currentlySelectedSubIconPath = pth;


            Level2IconSelected(selectedContainer);
        }
        public static Windows.UI.Xaml.Shapes.Path CreateBezierPath(Windows.UI.Input.Inking.InkStroke stroke)
        {
            // Create Bezier geometries using information provided by the stroke's segments
            var figure = new Windows.UI.Xaml.Media.PathFigure();
            var segments = stroke.GetRenderingSegments().GetEnumerator();
            segments.MoveNext();
            // First segment is degenerate and corresponds to initial position
            figure.StartPoint = segments.Current.Position;
            // Now loop through all remaining segments
            while (segments.MoveNext())
            {
                var bs = new Windows.UI.Xaml.Media.BezierSegment();
                bs.Point1 = segments.Current.BezierControlPoint1;
                bs.Point2 = segments.Current.BezierControlPoint2;
                bs.Point3 = segments.Current.Position;
                figure.Segments.Add(bs);
            }

            // Create and initialize the data structures necessary to render the figure
            var geometry = new Windows.UI.Xaml.Media.PathGeometry();
            geometry.Figures.Add(figure);
            var path = new Windows.UI.Xaml.Shapes.Path();
            path.Data = geometry;

            // Set the stroke's graphical properties, which are controlled by the Path object
            path.Stroke = new Windows.UI.Xaml.Media.SolidColorBrush(stroke.DrawingAttributes.Color);
            path.StrokeThickness = stroke.DrawingAttributes.Size.Width;
            path.StrokeLineJoin = Windows.UI.Xaml.Media.PenLineJoin.Round;
            path.StrokeStartLineCap = Windows.UI.Xaml.Media.PenLineCap.Round;

            return path;
        }
Exemple #9
0
        private static UIPath GetUIPath(GraphicsPath path)
        {
            var uipath = new UIPath();

            var  geometry = new PathGeometry();
            var  figure   = new PathFigure();
            bool first    = true;

            foreach (var obj in path._segments)
            {
                var line = obj as GraphicsPath._LineSegment;
                if (line != null)
                {
                    if (first)
                    {
                        first             = false;
                        figure.StartPoint = new UIPoint(line.x1, line.y1);
                    }

                    figure.Segments.Add(new LineSegment()
                    {
                        Point = new UIPoint(line.x1, line.y1)
                    });
                    figure.Segments.Add(new LineSegment()
                    {
                        Point = new UIPoint(line.x2, line.y2)
                    });
                    continue;
                }

                var bezier = obj as GraphicsPath._BezierSegment;
                if (bezier != null)
                {
                    if (first)
                    {
                        first             = false;
                        figure.StartPoint = new UIPoint(bezier.x1, bezier.y1);
                    }

                    figure.Segments.Add(new LineSegment()
                    {
                        Point = new UIPoint(bezier.x1, bezier.y1)
                    });
                    figure.Segments.Add(new BezierSegment()
                    {
                        Point1 = new UIPoint(bezier.x2, bezier.y2),
                        Point2 = new UIPoint(bezier.x3, bezier.y3),
                        Point3 = new UIPoint(bezier.x4, bezier.y4),
                    });
                    continue;
                }
            }
            figure.IsClosed = path._closed;
            geometry.Figures.Add(figure);
            uipath.Data = geometry;

            return(uipath);
        }
Exemple #10
0
        private static PathGeometry Clone(string data)
        {
            string p = "<Path xmlns=\"http://schemas.microsoft.com/winfx/2006/xaml/presentation\" Data=\"" + data + "\"/>";

            Windows.UI.Xaml.Shapes.Path o = XamlReader.Load(p) as Windows.UI.Xaml.Shapes.Path;
            PathGeometry geo = Clone(o.Data as PathGeometry);

            return(geo);
        }
Exemple #11
0
        protected override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            if (_path == null)
            {
                _path = GetTemplateChild("pth") as Windows.UI.Xaml.Shapes.Path;
                FillPathData(_path, PathType);
            }
        }
        public object Convert(object value, Type targetType, object parameter, string language)
        {
            string temp      = (string)Application.Current.Resources[(string)value];
            string pthString = @"<Path xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" 
                Data=""" + temp + @""" />";

            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)Windows.UI.Xaml.Markup.XamlReader.Load(pthString);
            pth.Stretch = Stretch.Uniform;
            pth.Fill    = new SolidColorBrush(Windows.UI.Colors.White);
            return(pth);
        }
Exemple #13
0
        private void grdIcon_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            this.sbHighlightMenuItemSelected.Stop();
            this.SelectedMenuItemWidth = 0;

            Grid selectedContainer = (Grid)sender;


            //SET SELECTED ICON
            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)((ContentControl)selectedContainer.Children[0]).Content;

            if (currentlySelectedIconPath != null)
            {
                //unselect it
                currentlySelectedIconPath.Fill = TabLabelColor_Grey;

                if (currentlySelectedIconPath == pth)
                {
                    currentlySelectedIconPath = null;
                    return;
                }

                currentlySelectedIconPath = null;
            }

            // SET THE SUBMENU

            this.SelectedSubIconItems.Clear();
            NotifyPropertyChanged("SelectedSubIconItems");



            if (selectedContainer.DataContext != null && selectedContainer.DataContext is IconItem)
            {
                IconItem si = (IconItem)selectedContainer.DataContext;
                if (si.IconItems != null)
                {
                    foreach (var i in si.IconItems)
                    {
                        this.SelectedSubIconItems.Add(i);
                    }
                    NotifyPropertyChanged("SelectedSubIconItems");
                }
            }


            //select it
            pth.Fill = TabLabelColor_White;
            currentlySelectedIconPath = pth;

            Level1IconSelected(selectedContainer);
            Level2AnimateMenu(selectedContainer);
        }
        private void DrawABezierCurve()
        {
            // Define the path properties: stroke, color, thickness
            var path = new Windows.UI.Xaml.Shapes.Path();

            path.Stroke          = new SolidColorBrush(Windows.UI.Colors.Green);
            path.StrokeThickness = 6;

            // The path takes a 'GeometryGroup' for all segments of the path
            var geometryGroup = new GeometryGroup();

            // In this GeometryGroup we can add several 'PathGeometry'
            var pathGeometry = new PathGeometry();

            // In this PathGeometry, we have a 'Figures' property.
            // We affect a 'PathFigureCollection' to this property
            var pathFigureCollection = new PathFigureCollection();
            // The PathFigureCollection takes some 'PathFigure'
            var pathFigure = new PathFigure();

            pathFigure.StartPoint = new Windows.Foundation.Point(100, 100);
            pathFigureCollection.Add(pathFigure);
            pathGeometry.Figures = pathFigureCollection;

            // The PathFigure we created is empty; We just defined the starting point
            // We now create this PathFigure with a 'PathSegmentCollection' which takes 'PathSegment'

            // The PathSegment we create is a Bezier curve
            pathSegment        = new BezierSegment();
            pathSegment.Point1 = new Point(100, 100);
            pathSegment.Point2 = new Point(300, 300);
            pathSegment.Point3 = new Point(500, 100);

            var pathSegmentCollection = new PathSegmentCollection();

            pathSegmentCollection.Add(pathSegment);

            // So we affect the PathSegmentCollection to the PathFigure
            pathFigure.Segments = pathSegmentCollection;

            // The PathFigure was already affected to the 'Figures' collection of
            // the PathGeometry object
            // We add this PathGeometry object to the 'GeometryGroup'
            geometryGroup.Children.Add(pathGeometry);

            // Finally, we give to the path the data corresponding to the GeometryGroup
            path.Data = geometryGroup;

            // We add the path to the Canvas
            layoutRoot.Children.Add(path);
        }
        private void NodeLinked(NodeConnection from, NodeConnection to)
        {
            Debug.WriteLine("Linked {0} -> {1}", from.ConnectedNodeId, to.ConnectedNodeId);
            NodeBase nodeFrom = null;
            NodeBase nodeTo   = null;

            foreach (var child in this.canvasDiagram.Children)
            {
                if (child is NodeBase)
                {
                    var node = child as NodeBase;
                    if (node.NodeId == from.ConnectedNodeId)
                    {
                        nodeFrom = node;
                    }
                    if (node.NodeId == to.ConnectedNodeId)
                    {
                        nodeTo = node;
                    }
                }
            }

            var   fromPoint = nodeFrom.GetPosition();
            var   toPoint   = nodeTo.GetPosition();
            Point distance  = new Point(toPoint.X - fromPoint.X, toPoint.Y - fromPoint.Y);

            BezierSegment segment = new BezierSegment();

            segment.Point1 = new Point(fromPoint.X + distance.X / 3, fromPoint.Y - 100);
            segment.Point2 = new Point(fromPoint.X + distance.X * 2 / 3, toPoint.Y + 100);
            segment.Point3 = nodeTo.GetPosition();

            PathFigure figure = new PathFigure();

            figure.StartPoint = nodeFrom.GetPosition();
            figure.Segments.Add(segment);

            PathGeometry geo = new PathGeometry();

            geo.Figures.Add(figure);

            Windows.UI.Xaml.Shapes.Path path = new Windows.UI.Xaml.Shapes.Path();
            path.StrokeThickness = 2;
            path.Stroke          = new SolidColorBrush(Colors.Black);

            path.Data = geo;

            this.canvasDiagram.Children.Add(path);
        }
Exemple #16
0
        private void Pad_PointerMoved(object sender, PointerRoutedEventArgs e)
        {
            Windows.UI.Input.PointerPoint point = e.GetCurrentPoint(Pad);
            bool fire = (e.Pointer.PointerDeviceType == Windows.Devices.Input.PointerDeviceType.Mouse) ?
                        point.Properties.IsLeftButtonPressed : point.IsInContact;

            if (fire)
            {
                Windows.UI.Xaml.Shapes.Path path = ((Windows.UI.Xaml.Shapes.Path)sender);
                if (Direction != null)
                {
                    this.Direction(path, (Directions)Enum.Parse(typeof(Directions), path.Name));
                }
            }
        }
Exemple #17
0
        private Windows.UI.Xaml.Shapes.Path GetMetroIcon(string key, Brush iconColor = null)
        {
            if (iconColor == null)
            {
                iconColor = TabLabelColor_Grey;
            }

            string temp      = (string)Application.Current.Resources[key];
            string pthString = @"<Path xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" 
                Data=""" + temp + @""" />";

            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)Windows.UI.Xaml.Markup.XamlReader.Load(pthString);
            pth.Stretch = Stretch.Uniform;
            pth.Fill    = iconColor;
            return(pth);
        }
 private path[] KTSerializer(String Data)
 {
     path[] Result = new path[2] { new path(), new path() };
     Result[(int)Paths.Transparent].Fill = new SolidColorBrush(Colors.Black);
     Result[(int)Paths.Opaque].Fill = new SolidColorBrush(Colors.White);
     String[] TO = Data.Split(new Char[] { '_' },StringSplitOptions.RemoveEmptyEntries);
     for (int t = 0; t < 2; t++)
     {
         String[] Split = TO[t].Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
         PathGeometry geo = new PathGeometry();
         geo.FillRule = FillRule.Nonzero;
         for (int i = 1; i < Split.Length; i++)
         {
             geo.Figures.Add(this.Parse(Split[i]));
         }
         Result[t].Data = geo;
     }
     return Result;
 }
        public Windows.UI.Xaml.Shapes.Path GenPath(String LineName, PathGeometry G)
        {
            Windows.UI.Xaml.Shapes.Path t_path      = new Windows.UI.Xaml.Shapes.Path();
            DoubleCollection            t_path_dash = new DoubleCollection();

            t_path_dash.Add(4);
            t_path_dash.Add(2);
            t_path.Name               = LineName;
            t_path.Fill               = new SolidColorBrush(Windows.UI.Color.FromArgb(0, 204, 204, 255));
            t_path.Stroke             = new SolidColorBrush(Windows.UI.Colors.White);
            t_path.StrokeStartLineCap = PenLineCap.Round;
            t_path.StrokeDashOffset   = 40;
            t_path.StrokeDashArray    = t_path_dash;
            t_path.StrokeDashCap      = PenLineCap.Round;
            t_path.StrokeThickness    = 4;
            t_path.Opacity            = 0.5;
            t_path.Data               = G;
            return(t_path);
        }
Exemple #20
0
        public Windows.UI.Xaml.Shapes.Path RetrieveMetroIconPath(string key, Brush iconColor = null)
        {
            LoggingService.LogInformation("Load Metro Icon Path", "BaseUserControl.RetrieveMetroIconPath");

            if (iconColor == null)
            {
                iconColor = new SolidColorBrush(Windows.UI.Colors.White);
            }

            string temp      = (string)Application.Current.Resources[key];
            string pthString = @"<Path xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" 
                Data=""" + temp + @""" />";

            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)Windows.UI.Xaml.Markup.XamlReader.Load(pthString);
            pth.Stretch = Stretch.Uniform;
            pth.Fill    = iconColor;
            pth.Width   = 25;
            pth.Height  = 25;

            return(pth);
        }
        public void RefreshLine(String linename)
        {
            if (linename == null)
            {
                return;
            }
            if (m_FunctionLineModels.ContainsKey(linename))
            {
                Model.TrickerStarLineModel line = (TrickerStarLineModel)m_FunctionLineModels[linename];


                TrickerStarFunctionNodeModel node_from_m = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[line.From.NodeName];
                TrickerStarFunctionNodeModel node_to_m   = (TrickerStarFunctionNodeModel)m_FunctionNodeModels[line.To.NodeName];

                Windows.UI.Xaml.Shapes.Path t_path = m_FunctionLineViews[line.LineName] as Windows.UI.Xaml.Shapes.Path;
                var geo = GenPathGeomentry(line.From, line.To);
                t_path.Data = geo;
            }
            else
            {
            }
        }
Exemple #22
0
        public void UpdateSelection()
        {
            foreach (var sp in bezierPaths)
            {
                Windows.UI.Xaml.Shapes.Path selectionPath = null;
                bool selectionPathExists = selectionPaths.TryGetValue(sp.Key, out selectionPath);

                if (sp.Key.Selected && !selectionPathExists)
                {
                    // If stroke is selected, we render its contour with the stroke's color and we fill it with white.
                    // To do so, we increase the original thickness of the stroke's path and we add an additional path
                    // of the color of the background on top of it.

                    // Increase stroke's width
                    sp.Value.StrokeThickness = sp.Key.DrawingAttributes.Size.Width + 2;

                    // Create additional stroke and store it in _selectionPaths so that we will be able to remove it later on.
                    selectionPath                 = CreateBezierPath(sp.Key);
                    selectionPath.Stroke          = render.Background;
                    selectionPath.StrokeThickness = sp.Key.DrawingAttributes.Size.Width;
                    selectionPaths.Add(sp.Key, selectionPath);

                    // Add path to render so that it is rendered (on top of all the elements with same ZIndex).
                    // We want the live render to be on top of the Bezier render, so we set the ZIndex of the elements of the
                    // live render to 1 and that of the elements of the Bezier render to 2.
                    render.Children.Add(selectionPath);
                    Windows.UI.Xaml.Controls.Canvas.SetZIndex(selectionPath, 2);
                }
                else if (selectionPathExists)
                {
                    // If stroke is not selected, reset its path's width and remove its selection path
                    sp.Value.StrokeThickness = sp.Key.DrawingAttributes.Size.Width;
                    selectionPaths.Remove(sp.Key);
                    render.Children.Remove(selectionPath);
                }
            }
        }
        private void NodeLinked(NodeConnection from, NodeConnection to)
        {
            Debug.WriteLine("Linked {0} -> {1}", from.ConnectedNodeId, to.ConnectedNodeId);
            NodeBase nodeFrom = null;
            NodeBase nodeTo = null;

            foreach (var child in this.canvasDiagram.Children)
            {
                if (child is NodeBase)
                {
                    var node = child as NodeBase;
                    if (node.NodeId == from.ConnectedNodeId)
                    {
                        nodeFrom = node;
                    }
                    if (node.NodeId == to.ConnectedNodeId)
                    {
                        nodeTo = node;
                    }
                }
            }

            var fromPoint = nodeFrom.GetPosition();
            var toPoint = nodeTo.GetPosition();
            Point distance = new Point(toPoint.X - fromPoint.X, toPoint.Y - fromPoint.Y);

            BezierSegment segment = new BezierSegment();
            segment.Point1 = new Point(fromPoint.X + distance.X / 3, fromPoint.Y - 100);
            segment.Point2 = new Point(fromPoint.X + distance.X * 2 / 3, toPoint.Y + 100);
            segment.Point3 = nodeTo.GetPosition();

            PathFigure figure = new PathFigure();
            figure.StartPoint = nodeFrom.GetPosition();
            figure.Segments.Add(segment);

            PathGeometry geo = new PathGeometry();
            geo.Figures.Add(figure);

            Windows.UI.Xaml.Shapes.Path path = new Windows.UI.Xaml.Shapes.Path();
            path.StrokeThickness = 2;
            path.Stroke = new SolidColorBrush(Colors.Black);

            path.Data = geo;

            this.canvasDiagram.Children.Add(path);
        }
Exemple #24
0
        private void divide_graham(object sender, RoutedEventArgs e)
        {
            Model.graham _model_graham = new graham();
            int          n             = 500;
            List <Point> point         = new List <Point>();

            canvas.Children.Clear();
            Random ran = new Random();

            for (int i = 0; i < 100; i++)
            {
                Point temp = new Point(ran.NextDouble() * n, ran.NextDouble() * n);
                point.Add(temp);
                Windows.UI.Xaml.Shapes.Path path = new Windows.UI.Xaml.Shapes.Path
                {
                    Data = new EllipseGeometry()
                    {
                        Center  = temp,
                        RadiusX = 5,
                        RadiusY = 5
                    },
                    Fill = new SolidColorBrush(Colors.Gray),
                    //Fill = new SolidColorBrush(Color.FromArgb(0xff,0xff,0xa,0x2))

                    //Stroke = new SolidColorBrush(Colors.Gray)
                };
                canvas.Children.Add(path);
            }



            //point = _model_graham.divide_conquer(point);
            //方法1
            //n = point.Count;
            ////for (int i = 0; i < n; i++)
            ////{
            ////    Windows.UI.Xaml.Shapes.Path path = new Windows.UI.Xaml.Shapes.Path
            ////    {
            ////        Data = new EllipseGeometry()
            ////        {
            ////            Center = point[i],
            ////            RadiusX = 5,
            ////            RadiusY = 5
            ////        },
            ////        Fill = new SolidColorBrush(Colors.Gray)
            ////    };
            ////    canvas.Children.Add(path);
            ////}
            //PathFigure Figures = new PathFigure();
            ////var figures=new LineSegment();
            //for (int i = 0; i < n; i++)
            //{
            //    Figures.Segments.Add(new LineSegment()
            //    {
            //        Point = point[i]
            //    });
            //    /*new PathFigure().Segments.Add(new LineSegment() {})*/
            //    ;
            //}
            //Figures.Segments.Add(new LineSegment()
            //{
            //    Point = point[0]
            //});
            //Figures.StartPoint = point[0];

            //Windows.UI.Xaml.Shapes.Path PathFigure = new Path()
            //{
            //    Data = new PathGeometry()
            //    {
            //        Figures = new PathFigureCollection()
            //        {
            //            Figures
            //        }
            //    },
            //    Stroke = new SolidColorBrush(Colors.Gray)
            //};
            //canvas.Children.Add(PathFigure);


            //方法2
            //List<TuLine> tuline = _model_graham.brute(point);

            //var path_figure = new PathGeometry();

            //foreach (TuLine temp in tuline)
            //{
            //    var path_segment = new PathFigure()
            //    {
            //        StartPoint = temp.Begin
            //    };

            //    var line = new LineSegment()
            //    {
            //        Point = temp.End
            //    };
            //    path_segment.Segments.Add(line);

            //    path_figure.Figures.Add(path_segment);
            //}
            //canvas.Children.Add(new Path()
            //{
            //    Stroke = new SolidColorBrush(Colors.Gray),
            //    StrokeThickness = 1,
            //    Data = path_figure
            //});


            //方法3
            //point = _model_graham.brute_conquer(point);
            //PathGeometry path_figure = new PathGeometry();
            //for (int i = 0; i < point.Count; i++)
            //{
            //    PathFigure path_segment = new PathFigure()
            //    {
            //        StartPoint = point[i]
            //    };
            //    i++;
            //    LineSegment line = new LineSegment()
            //    {
            //        Point = point[i]
            //    };
            //    path_segment.Segments.Add(line);
            //    path_figure.Figures.Add(path_segment);
            //}
            //canvas.Children.Add(new Path()
            //{
            //    Stroke = new SolidColorBrush(Colors.Gray),
            //    StrokeThickness = 1,
            //    Data = path_figure
            //});

            //方法3.1
            point = _model_graham.brute_conquer(point);

            for (int i = 0; i < point.Count; i++)
            {
                for (int j = i + 1; j < point.Count; j++)
                {
                    if (Math.Abs(point[i].X - point[j].X) < 0.000001 && Math.Abs(point[i].Y - point[j].Y) < 0.000001)
                    {
                        point.RemoveAt(j);
                        j--;
                    }
                }
            }

            point = _model_graham.divide_conquer(point, true);

            n = point.Count;

            PathFigure figures = new PathFigure();

            for (int i = 0; i < n; i++)
            {
                figures.Segments.Add(new LineSegment()
                {
                    Point = point[i]
                });
            }
            figures.Segments.Add(new LineSegment()
            {
                Point = point[0]
            });
            figures.StartPoint = point[0];

            Windows.UI.Xaml.Shapes.Path path_figure = new Path()
            {
                Data = new PathGeometry()
                {
                    Figures = new PathFigureCollection()
                    {
                        figures
                    }
                },
                Stroke = new SolidColorBrush(Colors.Gray)
            };
            canvas.Children.Add(path_figure);
        }
        private Windows.UI.Xaml.Shapes.Path CreateNewPath()
        {
            _currentPath = new Windows.UI.Xaml.Shapes.Path();
            _currentPath.Stroke = _foregroundBrush;

            _currentPath.StrokeThickness = 1;
            _currentPath.Data = new PathGeometry();
            ((PathGeometry)_currentPath.Data).Figures = new PathFigureCollection();
            _currentFigureIndex = -1;
            return _currentPath;
        }
 public WpfCanvas()
 {
     _canvas = new Windows.UI.Xaml.Controls.Canvas();
     _currentPath = CreateNewPath();
 }
Exemple #27
0
        private void BuildArc(int radius, int arcThickness, Windows.UI.Color color, double angleStart, double angleEnd)
        {
            double angleChange = 44;
            

            Point startPoint = CalculateCartesianPoint(angleStart, radius);
            Point endPoint = CalculateCartesianPoint(angleEnd, radius);


            // Create an ArcSegment to define the geometry of the path.
            // The Size property of this segment is animated.
            ArcSegment myArcSegment = new ArcSegment();
            myArcSegment.Size = new Size(radius, radius);
            myArcSegment.SweepDirection = SweepDirection.Clockwise;
            myArcSegment.Point = endPoint;
            myArcSegment.IsLargeArc = false;


            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
            myPathSegmentCollection.Add(myArcSegment);

            // Create a PathFigure to be used for the PathGeometry of myPath.
            PathFigure myPathFigure = new PathFigure();
            myPathFigure.StartPoint = startPoint;
            myPathFigure.Segments = myPathSegmentCollection;

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            myPathFigureCollection.Add(myPathFigure);

            PathGeometry myPathGeometry = new PathGeometry();
            myPathGeometry.Figures = myPathFigureCollection;

            // Create a path to draw a geometry with.
            Windows.UI.Xaml.Shapes.Path myPath = new Windows.UI.Xaml.Shapes.Path();
            myPath.Stroke = new SolidColorBrush(color);
            myPath.StrokeThickness = arcThickness;

            // specify the shape of the path using the path geometry.
            myPath.Data = myPathGeometry;

            Canvas containerCanvas = new Canvas();
            containerCanvas.Children.Add(myPath);
            containerCanvas.PointerPressed += (o,a) => {

                sbPressButton.Begin();


                Messenger.Default.Send(new ArcMenuItemSelectedMessage(this.MenuId.ToString()) { Identifier = "AMS" });

            };

            layoutRoot.Children.Add(containerCanvas);

            ((CompositeTransform)pthTriangle.RenderTransform).TranslateX = radius;
            //((CompositeTransform)pthTriangle.RenderTransform).TranslateY = radius;
            ((CompositeTransform)grdTriangle.RenderTransform).Rotation = angleStart +  (angleChange/2);
        }
        /// <summary>
        /// Draws a path
        /// </summary>
        /// <param name="ops"></param>
        /// <param name="pen"></param>
        /// <param name="brush"></param>
        public void DrawPath(IEnumerable <PathOp> ops, Pen pen = null, NGraphics.Brush brush = null)
        {
            if (pen == null && brush == null)
            {
                return;
            }

            var pathEl = new Windows.UI.Xaml.Shapes.Path();

            if (brush != null)
            {
                pathEl.Fill = GetBrush(brush);
            }

            if (pen != null)
            {
                pathEl.Stroke          = GetStroke(pen);
                pathEl.StrokeThickness = pen.Width;
            }

            var geo = new StringBuilder();

            foreach (var op in ops)
            {
                var mt = op as MoveTo;
                if (mt != null)
                {
                    geo.AppendFormat(CultureInfo.InvariantCulture, " M {0},{1}", mt.Point.X, mt.Point.Y);
                    continue;
                }

                var lt = op as LineTo;
                if (lt != null)
                {
                    geo.AppendFormat(CultureInfo.InvariantCulture, " L {0},{1}", lt.Point.X, lt.Point.Y);
                    continue;
                }

                var at = op as ArcTo;
                if (at != null)
                {
                    var p = at.Point;
                    var r = at.Radius;

                    geo.AppendFormat(CultureInfo.InvariantCulture, " A {0},{1} 0 {2} {3} {4},{5}",
                                     r.Width, r.Height,
                                     at.LargeArc ? 1 : 0,
                                     at.SweepClockwise ? 1 : 0,
                                     p.X, p.Y);
                    continue;
                }

                var ct = op as CurveTo;
                if (ct != null)
                {
                    var p  = ct.Point;
                    var c1 = ct.Control1;
                    var c2 = ct.Control2;
                    geo.AppendFormat(CultureInfo.InvariantCulture, " C {0},{1} {2},{3} {4},{5}",
                                     c1.X, c1.Y, c2.X, c2.Y, p.X, p.Y);
                    continue;
                }

                var cp = op as ClosePath;
                if (cp != null)
                {
                    geo.Append(" z");
                    continue;
                }
            }

            // Convert path string to geometry
            var b = new Binding {
                Source = geo.ToString()
            };

            BindingOperations.SetBinding(pathEl, Windows.UI.Xaml.Shapes.Path.DataProperty, b);

            pathEl.RenderTransform = Conversions.GetTransform(CurrentTransform);
            _canvas.Children.Add(pathEl);
        }
Exemple #29
0
        private void grdIcon_PointerReleased(object sender, PointerRoutedEventArgs e)
        {
            this.sbHighlightMenuItemSelected.Stop();
            this.SelectedMenuItemWidth = 0;
            
            Grid selectedContainer = (Grid)sender;
            

            //SET SELECTED ICON
            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)((ContentControl)selectedContainer.Children[0]).Content;

            if (currentlySelectedIconPath != null)
            {

                //unselect it
                currentlySelectedIconPath.Fill = TabLabelColor_Grey;

                if (currentlySelectedIconPath == pth)
                {
                    currentlySelectedIconPath = null;
                    return;
                }

                currentlySelectedIconPath = null;

            }

            // SET THE SUBMENU
            
            this.SelectedSubIconItems.Clear();
            NotifyPropertyChanged("SelectedSubIconItems");



            if (selectedContainer.DataContext != null && selectedContainer.DataContext is IconItem)
            {
                
                IconItem si = (IconItem)selectedContainer.DataContext;
                if (si.IconItems != null)
                {
                    foreach (var i in si.IconItems)
                    {
                        this.SelectedSubIconItems.Add(i);
                    }
                    NotifyPropertyChanged("SelectedSubIconItems");
                }
            }


            //select it
            pth.Fill = TabLabelColor_White;
            currentlySelectedIconPath = pth;

            Level1IconSelected(selectedContainer);
            Level2AnimateMenu(selectedContainer);
        }
Exemple #30
0
        private EntityLine_Model AddLine(EntityLine_Model EntityLine,String LineName = null)
        {
            var frame_from = (EntityFrame_Model)m_Elements.m_Frames[EntityLine.from_Name];
            var frame_to   = (EntityFrame_Model)m_Elements.m_Frames[EntityLine.to_Name];

            string from_slot_name = frame_from.UIEntity.m_OutputSlot[EntityLine.from_index];
            string to_slot_name   = frame_to.UIEntity.m_InputSlot[EntityLine.to_index];

            //TODO:/// DELETE Existing Line
            if (frame_from.m_Lines.Contains(from_slot_name))
            {
                var from_line_name = (String)frame_from.m_Lines[from_slot_name];
                DeleteLine(from_line_name);
            }
            if (frame_to.m_Lines.Contains(to_slot_name))
            {
                var to_line_name = (String)frame_to.m_Lines[to_slot_name];
                DeleteLine(to_line_name);
            }
            ////// Refresh Frame
            frame_from = (EntityFrame_Model)m_Elements.m_Frames[EntityLine.from_Name];
            frame_to   = (EntityFrame_Model)m_Elements.m_Frames[EntityLine.to_Name];

            ///// Fill Line Params
            var line = new EntityLine_Model();

            line.Name = "LINE" + EntityElements.RandToken();
            if (LineName != null)
            {
                line.Name = LineName;
            }
            line.from_Name     = EntityLine.from_Name;
            line.to_Name       = EntityLine.to_Name;
            line.from_SlotName = from_slot_name;
            line.to_SlotName   = to_slot_name;
            line.from_point    = new System.Drawing.Point((int)frame_from.UIEntity.Translation.X,(int)frame_from.UIEntity.Translation.Y);
            line.to_point      = new System.Drawing.Point((int)frame_to.UIEntity.Translation.X,(int)frame_to.UIEntity.Translation.Y);
            line.from_index    = EntityLine.from_index;
            line.to_index      = EntityLine.to_index;
            line.from_point.Y += EntityFrame_Model.SlotIndexToY(line.from_index);
            line.to_point.Y   += EntityFrame_Model.SlotIndexToY(line.to_index);
            line.from_point.X += 300 * 1 - 8;
            line.to_point.X   += 300 * 0 + 8;
            Windows.UI.Xaml.Shapes.Path t_path = new Windows.UI.Xaml.Shapes.Path();


            var pathGeometry1         = new PathGeometry();
            var pathFigureCollection1 = new PathFigureCollection();
            var pathFigure1           = new PathFigure();

            pathFigure1.IsClosed   = false;
            pathFigure1.StartPoint = new Windows.Foundation.Point(line.from_point.X,line.from_point.Y);
            pathFigureCollection1.Add(pathFigure1);
            pathGeometry1.Figures = pathFigureCollection1;

            var pathSegmentCollection1 = new PathSegmentCollection();
            var pathSegment1           = new BezierSegment();

            pathSegment1.Point1 = new Point(line.from_point.X + 100,line.from_point.Y);
            pathSegment1.Point2 = new Point(line.to_point.X - 100,line.to_point.Y);
            pathSegment1.Point3 = new Point(line.to_point.X,line.to_point.Y);
            pathSegmentCollection1.Add(pathSegment1);

            pathFigure1.Segments = pathSegmentCollection1;

            DoubleCollection t_path_dash = new DoubleCollection();

            t_path_dash.Add(4);
            t_path_dash.Add(2);



            t_path.Name               = line.Name;
            t_path.Fill               = new SolidColorBrush(Windows.UI.Color.FromArgb(0,204,204,255));
            t_path.Stroke             = new SolidColorBrush(Windows.UI.Colors.Black);
            t_path.StrokeStartLineCap = PenLineCap.Round;
            t_path.StrokeDashOffset   = 40;
            t_path.StrokeDashArray    = t_path_dash;
            t_path.StrokeDashCap      = PenLineCap.Round;
            t_path.StrokeThickness    = 4;
            t_path.Opacity            = 0.5;
            t_path.Data               = pathGeometry1;
            line.UIPath               = t_path;
            Canvas.SetZIndex(line.UIPath,5);
            m_Elements.m_Lines[line.Name] = line;

            frame_from.m_Lines[from_slot_name]        = line.Name;
            frame_to.m_Lines[to_slot_name]            = line.Name;
            m_Elements.m_Frames[EntityLine.from_Name] = frame_from;
            m_Elements.m_Frames[EntityLine.to_Name]   = frame_to;


            this.C_MAINGRID.Children.Add(t_path);

            return(line);
        }
        /// <summary>
        /// Draws a path
        /// </summary>
        /// <param name="ops"></param>
        /// <param name="pen"></param>
        /// <param name="brush"></param>
        public void DrawPath(IEnumerable<PathOp> ops, Pen pen = null, NGraphics.Brush brush = null)
        {
            if (pen == null && brush == null)
                return;

            var pathEl = new Windows.UI.Xaml.Shapes.Path();

            if (brush != null)
                pathEl.Fill = GetBrush(brush);

            if (pen != null)
            {
                pathEl.Stroke = GetStroke(pen);
                pathEl.StrokeThickness = pen.Width;
            }

            var geo = new StringBuilder();
            
            foreach(var op in ops)
            {
                var mt = op as MoveTo;
                if (mt != null)
                {
                    geo.AppendFormat(CultureInfo.InvariantCulture, " M {0},{1}", mt.Point.X, mt.Point.Y);
                    continue;
                }

                var lt = op as LineTo;
                if(lt != null)
                {
                    geo.AppendFormat(CultureInfo.InvariantCulture, " L {0},{1}", lt.Point.X, lt.Point.Y);
                    continue;
                }

                var at = op as ArcTo;
                if (at != null)
                {
                    var p = at.Point;
                    var r = at.Radius;

                    geo.AppendFormat(CultureInfo.InvariantCulture, " A {0},{1} 0 {2} {3} {4},{5}",
                        r.Width, r.Height,
                        at.LargeArc ? 1 : 0,
                        at.SweepClockwise ? 1 : 0,
                        p.X, p.Y);
                    continue;
                }

                var ct = op as CurveTo;
                if(ct != null)
                {
                    var p = ct.Point;
                    var c1 = ct.Control1;
                    var c2 = ct.Control2;
                    geo.AppendFormat(CultureInfo.InvariantCulture, " C {0},{1} {2},{3} {4},{5}",
                        c1.X, c1.Y, c2.X, c2.Y, p.X, p.Y);
                    continue;
                }

                var cp = op as ClosePath;
                if(cp != null)
                {
                    geo.Append(" z");
                    continue;
                }
            }

            // Convert path string to geometry
            var b = new Binding { Source = geo.ToString() };
            BindingOperations.SetBinding(pathEl, Windows.UI.Xaml.Shapes.Path.DataProperty, b);

            pathEl.RenderTransform = Conversions.GetTransform(CurrentTransform);
            _canvas.Children.Add(pathEl);
        }
        private static void RenderAllStrokes(InkCanvas canvas, Panel parent)
        {
            // Get the InkStroke objects.
            IReadOnlyList<InkStroke> inkStrokes = canvas.InkPresenter.StrokeContainer.GetStrokes();

            List<Windows.UI.Xaml.Shapes.Path> retVal = new List<Windows.UI.Xaml.Shapes.Path>();

            // Process each stroke.
            foreach (InkStroke inkStroke in inkStrokes)
            {
                PathGeometry pathGeometry = new PathGeometry();
                PathFigureCollection pathFigures = new PathFigureCollection();
                PathFigure pathFigure = new PathFigure();
                PathSegmentCollection pathSegments = new PathSegmentCollection();

                // Create a path and define its attributes.
                Windows.UI.Xaml.Shapes.Path path = new Windows.UI.Xaml.Shapes.Path();
                path.Stroke = new SolidColorBrush(inkStroke.DrawingAttributes.Color);
                path.StrokeThickness = inkStroke.DrawingAttributes.Size.Height;
                if (inkStroke.DrawingAttributes.DrawAsHighlighter)
                {
                    path.Opacity = .4d;
                }

                // Get the stroke segments.
                IReadOnlyList<InkStrokeRenderingSegment> segments;
                segments = inkStroke.GetRenderingSegments();

                // Process each stroke segment.
                bool first = true;
                foreach (InkStrokeRenderingSegment segment in segments)
                {
                    // The first segment is the starting point for the path.
                    if (first)
                    {
                        pathFigure.StartPoint = segment.BezierControlPoint1;
                        first = false;
                    }

                    // Copy each ink segment into a bezier segment.
                    BezierSegment bezSegment = new BezierSegment();
                    bezSegment.Point1 = segment.BezierControlPoint1;
                    bezSegment.Point2 = segment.BezierControlPoint2;
                    bezSegment.Point3 = segment.Position;

                    // Add the bezier segment to the path.
                    pathSegments.Add(bezSegment);
                }

                // Build the path geometerty object.
                pathFigure.Segments = pathSegments;
                pathFigures.Add(pathFigure);
                pathGeometry.Figures = pathFigures;

                // Assign the path geometry object as the path data.
                path.Data = pathGeometry;

                // Render the path by adding it as a child of the Canvas object.
                parent.Children.Add(path);
            }
        }
Exemple #33
0
        private void grdSubIcon_PointerReleased(object sender, PointerRoutedEventArgs e)
        {

            Grid selectedContainer = (Grid)sender;


            //UNSELECT PREVIOUS SELECTED ICON
            Windows.UI.Xaml.Shapes.Path pth = (Windows.UI.Xaml.Shapes.Path)((ContentControl)selectedContainer.Children[0]).Content;

            if (currentlySelectedSubIconPath != null)
            {

                //unselect it
                currentlySelectedSubIconPath.Fill = TabLabelColor_Grey;

                if (currentlySelectedSubIconPath == pth)
                {
                    currentlySelectedSubIconPath = null;
                    return;
                }

            }


            //select it
            pth.Fill = TabLabelColor_White;
            currentlySelectedSubIconPath = pth;


            Level2IconSelected(selectedContainer);
        }
Exemple #34
0
        private void BuildArc(int radius, int arcThickness, Windows.UI.Color color, double angleStart, double angleEnd)
        {
            double angleChange = 44;


            Point startPoint = CalculateCartesianPoint(angleStart, radius);
            Point endPoint   = CalculateCartesianPoint(angleEnd, radius);


            // Create an ArcSegment to define the geometry of the path.
            // The Size property of this segment is animated.
            ArcSegment myArcSegment = new ArcSegment();

            myArcSegment.Size           = new Size(radius, radius);
            myArcSegment.SweepDirection = SweepDirection.Clockwise;
            myArcSegment.Point          = endPoint;
            myArcSegment.IsLargeArc     = false;


            PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();

            myPathSegmentCollection.Add(myArcSegment);

            // Create a PathFigure to be used for the PathGeometry of myPath.
            PathFigure myPathFigure = new PathFigure();

            myPathFigure.StartPoint = startPoint;
            myPathFigure.Segments   = myPathSegmentCollection;

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();

            myPathFigureCollection.Add(myPathFigure);

            PathGeometry myPathGeometry = new PathGeometry();

            myPathGeometry.Figures = myPathFigureCollection;

            // Create a path to draw a geometry with.
            Windows.UI.Xaml.Shapes.Path myPath = new Windows.UI.Xaml.Shapes.Path();
            myPath.Stroke          = new SolidColorBrush(color);
            myPath.StrokeThickness = arcThickness;

            // specify the shape of the path using the path geometry.
            myPath.Data = myPathGeometry;

            Canvas containerCanvas = new Canvas();

            containerCanvas.Children.Add(myPath);
            containerCanvas.PointerPressed += (o, a) => {
                sbPressButton.Begin();


                Messenger.Default.Send(new ArcMenuItemSelectedMessage(this.MenuId.ToString())
                {
                    Identifier = "AMS"
                });
            };

            layoutRoot.Children.Add(containerCanvas);

            ((CompositeTransform)pthTriangle.RenderTransform).TranslateX = radius;
            //((CompositeTransform)pthTriangle.RenderTransform).TranslateY = radius;
            ((CompositeTransform)grdTriangle.RenderTransform).Rotation = angleStart + (angleChange / 2);
        }
Exemple #35
0
 public TrickerStarNodeView()
 {
     this.InitializeComponent();
     m_TempPath = GenPath("TEMP_PATH", null);
     C_MAIN_CANVAS.Children.Add(m_TempPath);
 }
 public void Stroke()
 {
     _canvas.Children.Add(_currentPath);
     _currentPath = CreateNewPath();
 }
        internal static async Task Render(CompositionEngine compositionEngine, SharpDX.Direct2D1.RenderTarget renderTarget, FrameworkElement rootElement, Jupiter.Shapes.Path path)
        {
            var rect = path.GetBoundingRect(rootElement).ToSharpDX();
            var fill = await path.Fill.ToSharpDX(renderTarget, rect);

            var stroke = await path.Stroke.ToSharpDX(renderTarget, rect);

            var layer        = path.CreateAndPushLayerIfNecessary(renderTarget, rootElement);
            var oldTransform = renderTarget.Transform;

            renderTarget.Transform = new Matrix3x2(
                1, 0, 0, 1, rect.Left, rect.Top);
            //renderTarget.PushLayer(ref layerParameters, layer);

            var d2dGeometry = path.Data.ToSharpDX(compositionEngine.D2DFactory, rect);

            if (fill != null)
            {
                renderTarget.FillGeometry(d2dGeometry, fill, null);
            }

            if (stroke != null &&
                path.StrokeThickness > 0)
            {
                renderTarget.DrawGeometry(
                    d2dGeometry,
                    stroke,
                    (float)path.StrokeThickness,
                    path.GetStrokeStyle(compositionEngine.D2DFactory));
            }

            //if (path.StrokeThickness > 0 &&
            //    stroke != null)
            //{
            //    var halfThickness = (float)(path.StrokeThickness * 0.5);
            //    roundedRect.Rect = rect.Eroded(halfThickness);

            //    if (fill != null)
            //    {
            //        renderTarget.FillRoundedRectangle(roundedRect, fill);
            //    }

            //    renderTarget.DrawRoundedRectangle(
            //        roundedRect,
            //        stroke,
            //        (float)path.StrokeThickness,
            //        path.GetStrokeStyle(compositionEngine.D2DFactory));
            //}
            //else
            //{
            //    renderTarget.FillRoundedRectangle(roundedRect, fill);
            //}

            if (layer != null)
            {
                renderTarget.PopLayer();
                layer.Dispose();
            }

            renderTarget.Transform = oldTransform;
        }
        // throws ArgumentException if pointerPoint.pointerId is already in live rendering mode
        public void EnterLiveRendering(Windows.UI.Input.PointerPoint pointerPoint, Windows.UI.Input.Inking.InkDrawingAttributes drawingAttributes)
        {
            uint pointerId = pointerPoint.PointerId;

            // Create and initialize the data structures necessary to render a polyline in XAML.
            var stroke = new Windows.UI.Xaml.Media.PolyLineSegment();
            stroke.Points.Add(pointerPoint.Position);
            var figure = new Windows.UI.Xaml.Media.PathFigure();
            figure.StartPoint = pointerPoint.Position;
            figure.Segments.Add(stroke);
            var geometry = new Windows.UI.Xaml.Media.PathGeometry();
            geometry.Figures.Add(figure);
            var path = new Windows.UI.Xaml.Shapes.Path();
            path.Data = geometry;

            // Set the stroke's graphical properties, which are controlled by the Path object
            path.Stroke = new Windows.UI.Xaml.Media.SolidColorBrush(drawingAttributes.Color);
            path.StrokeThickness = drawingAttributes.Size.Width;
            path.StrokeLineJoin = Windows.UI.Xaml.Media.PenLineJoin.Round;
            path.StrokeStartLineCap = Windows.UI.Xaml.Media.PenLineCap.Round;

            // Update dictionaries
            liveStrokes.Add(pointerId, stroke); // throws ArgumentException if pointerId is already in the dictionary
            livePaths.Add(pointerId, path);     // throws ArgumentException if pointerId is already in the dictionary

            // Add path to render so that it is rendered (on top of all the elements with same ZIndex).
            // We want the live render to be on top of the Bezier render, so we set the ZIndex of the elements of the
            // live render to 2 and that of the elements of the Bezier render to 1.
            render.Children.Add(path);
            Windows.UI.Xaml.Controls.Canvas.SetZIndex(path, 2);
        }
Exemple #39
0
        private void CreateAndAddItems()
        {
            SfRadialMenuItem Cut, Copy, Paste, Undo, Redo, Bold, Underline, Italic;
            TransformGroup   transformGroup  = new TransformGroup();
            RotateTransform  rotateTransform = new RotateTransform()
            {
                Angle = 3
            };
            ScaleTransform scaleTransform = new ScaleTransform()
            {
                ScaleX = 1, ScaleY = 1
            };

            transformGroup.Children.Add(rotateTransform);
            transformGroup.Children.Add(scaleTransform);
            Bold = new SfRadialMenuItem();
            Grid BoldHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox BoldViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path BoldPath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("F1M-240.817,-5140.75L-215.236,-5140.75C-210.17,-5140.75 -206.394,-5140.54 -203.906,-5140.12 -201.417,-5139.7 -199.189,-5138.82 -197.225,-5137.48 -195.261,-5136.14 -193.624,-5134.36 -192.314,-5132.13 -191.003,-5129.9 -190.351,-5127.41 -190.351,-5124.64 -190.351,-5121.65 -191.158,-5118.9 -192.771,-5116.39 -194.389,-5113.89 -196.579,-5112.01 -199.342,-5110.76 -195.443,-5109.62 -192.446,-5107.69 -190.351,-5104.95 -188.253,-5102.22 -187.208,-5099 -187.208,-5095.3 -187.208,-5092.39 -187.883,-5089.56 -189.236,-5086.81 -190.589,-5084.06 -192.439,-5081.86 -194.781,-5080.22 -197.124,-5078.58 -200.014,-5077.56 -203.446,-5077.19 -205.6,-5076.95 -210.796,-5076.81 -219.032,-5076.75L-240.817,-5076.75 -240.817,-5140.75z M-227.897,-5130.1L-227.897,-5115.3 -219.426,-5115.3C-214.391,-5115.3 -211.264,-5115.37 -210.041,-5115.52 -207.829,-5115.78 -206.088,-5116.54 -204.822,-5117.81 -203.557,-5119.07 -202.923,-5120.74 -202.923,-5122.81 -202.923,-5124.79 -203.469,-5126.39 -204.561,-5127.63 -205.652,-5128.87 -207.275,-5129.62 -209.426,-5129.88 -210.708,-5130.03 -214.391,-5130.1 -220.473,-5130.1L-227.897,-5130.1z M-227.897,-5104.65L-227.897,-5087.53 -215.933,-5087.53C-211.277,-5087.53 -208.324,-5087.67 -207.071,-5087.93 -205.15,-5088.28 -203.587,-5089.13 -202.377,-5090.48 -201.17,-5091.83 -200.564,-5093.65 -200.564,-5095.92 -200.564,-5097.84 -201.032,-5099.47 -201.964,-5100.81 -202.895,-5102.14 -204.24,-5103.12 -205.999,-5103.73 -207.761,-5104.34 -211.583,-5104.65 -217.46,-5104.65L-227.897,-5104.65z")
            };
            BoldPath.RenderTransform = transformGroup;
            BoldViewbox.Child        = BoldPath;
            BoldHeader.Children.Add(BoldViewbox);
            Bold.Header = BoldHeader;
            Bold.Click += WPBold;
            Underline   = new SfRadialMenuItem();
            Grid UnderlineHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox UnderlineViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path UnderlinePath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("M7.96874952316284,36.3745803833008L15.84375,36.3745803833008 15.84375,76.9683303833008 16.1162109375,81.8133010864258 16.93359375,86.0122756958008 18.2958984375,89.5652542114258 20.203125,92.4722366333008 22.6552734375,94.7332229614258 25.65234375,96.3482131958008 29.1943359375,97.3172073364258 33.28125,97.6402053833008 37.225341796875,97.3281936645508 40.6435508728027,96.3921585083008 43.5358848571777,94.8320999145508 45.9023399353027,92.6480178833008 47.7429161071777,89.8399124145508 49.0576133728027,86.4077835083008 49.846435546875,82.3516311645508 50.109375,77.6714553833008 50.109375,36.3745803833008 57.984375,36.3745803833008 57.984375,76.4058303833008 57.585205078125,83.0415725708008 56.3876914978027,88.7925491333008 54.3918418884277,93.6587600708008 51.5976524353027,97.6402053833008 48.0051231384277,100.736885070801 43.6142539978027,102.948799133301 38.425048828125,104.275947570801 32.4375,104.718330383301 26.70263671875,104.292793273926 21.732421875,103.016181945801 17.52685546875,100.888496398926 14.0859375,97.9097366333008 11.40966796875,94.0799026489258 9.498046875,89.3989944458008 8.35107421875,83.8670120239258 7.96874952316284,77.4839553833008 7.96874952316284,36.3745803833008z")
            };
            UnderlinePath.RenderTransform = transformGroup;
            UnderlineViewbox.Child        = UnderlinePath;
            UnderlineHeader.Children.Add(UnderlineViewbox);
            Underline.Header = UnderlineHeader;
            Underline.Click += WPUnderline;
            Italic           = new SfRadialMenuItem();
            Grid ItalicHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox ItalicViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path ItalicPath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("F1M-208.49,-4719.89L-209.008,-4718.14 -235.346,-4718.14 -234.683,-4719.89C-232.041,-4719.95 -230.295,-4720.17 -229.447,-4720.55 -228.062,-4721.08 -227.04,-4721.82 -226.376,-4722.77 -225.339,-4724.25 -224.27,-4726.89 -223.17,-4730.7L-212.029,-4769.31C-211.085,-4772.52 -210.614,-4774.94 -210.614,-4776.58 -210.614,-4777.39 -210.817,-4778.08 -211.226,-4778.65 -211.639,-4779.22 -212.256,-4779.65 -213.091,-4779.95 -213.926,-4780.25 -215.554,-4780.4 -217.977,-4780.4L-217.409,-4782.14 -192.679,-4782.14 -193.197,-4780.4C-195.213,-4780.43 -196.706,-4780.21 -197.682,-4779.74 -199.097,-4779.11 -200.174,-4778.21 -200.916,-4777.04 -201.654,-4775.88 -202.606,-4773.3 -203.77,-4769.31L-214.863,-4730.7C-215.868,-4727.14 -216.373,-4724.88 -216.373,-4723.9 -216.373,-4723.11 -216.175,-4722.45 -215.782,-4721.89 -215.389,-4721.34 -214.761,-4720.92 -213.891,-4720.62 -213.031,-4720.32 -211.226,-4720.08 -208.49,-4719.89z")
            };
            ItalicPath.RenderTransform = transformGroup;
            ItalicViewbox.Child        = ItalicPath;
            ItalicHeader.Children.Add(ItalicViewbox);
            Italic.Header = ItalicHeader;
            Italic.Click += WPItalic;
            Cut           = new SfRadialMenuItem();
            Grid CutHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox CutViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path CutPath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("M26.93272,40.905998L26.451015,41.976318 24.699699,46.260094 24.439299,46.437298 21.630575,52.664005C21.368874,53.533619 21.357073,54.478939 21.699675,55.054646 22.090179,55.712357 23.079786,56.020966 24.280296,55.861763 26.486116,55.570259 29.517443,53.617123 30.788252,49.075542 31.509558,46.499798 31.469257,44.511963 30.671051,43.16914 29.822144,41.747314 28.163231,41.153507 26.93272,40.905998z M11.809452,21.572449C8.7251377,21.600742 6.5700688,22.9643 5.5466814,24.369844 4.210753,26.208536 4.8657231,27.786457 7.3722467,28.260103L14.150891,28.755148 14.254991,28.702854 15.780988,28.872335 19.955578,29.176001C20.325277,27.981735 20.596077,26.236832 19.749779,24.812695 18.95038,23.469145 17.223885,22.487257 14.61439,21.891125 13.609521,21.661287 12.673059,21.564526 11.809452,21.572449z M43.601677,0L31.104164,30.593931 64,34.285347 55.42709,39.385468 38.033871,39.015766 31.391865,35.604153 29.14706,35.375153 28.790461,36.250156C30.869762,36.812656 33.401066,38.005566 34.957165,40.618874 36.48177,43.182285 36.69537,46.476799 35.591068,50.419617 33.666668,57.299545 28.55196,60.151161 24.841057,60.64336 21.628952,61.070564 18.648352,59.679455 17.22135,57.279045 16.519447,56.099339 16.921848,51.107117 16.990749,50.893318L18.683651,47.164303 23.837255,34.88295 11.005141,33.620747 6.8593082,33.422047C6.5311871,33.361946 1.6901219,31.174433 1.002491,30.01823 -0.4245705,27.617319 -0.39203876,24.054804 1.5142117,21.435192 3.7186239,18.408779 8.7628794,15.437566 15.726547,17.028872 19.718651,17.937576 22.511755,19.700785 24.036356,22.263296 25.624956,24.933706 25.423157,27.788721 24.901056,29.896128L25.817659,30.00013 26.742159,27.78722 26.984358,20.442987 35.029865,5.097682z")
            };
            CutPath.RenderTransform = transformGroup;
            CutViewbox.Child        = CutPath;
            CutHeader.Children.Add(CutViewbox);
            Cut.Header = CutHeader;
            Cut.Click += WPCut;
            Copy       = new SfRadialMenuItem();
            Grid CopyHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox CopyViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path CopyPath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("M31.687001,23.116L31.687001,31.394341C31.687001,31.394341,31.526705,36.832023,25.52624,36.359949L18.506,36.388395 18.506,49.587002 18.506001,54.153999 18.506,59.292614C18.506,59.812107,18.929218,60.233997,19.448625,60.233997L45.808704,60.233997C46.326101,60.233997,46.749998,59.812107,46.749998,59.292614L46.749998,24.057384C46.749998,23.539322,46.326101,23.116,45.808704,23.116z M20.552001,4.5669994L20.552001,14.60861C20.552001,14.60861,20.358706,21.203206,13.080177,20.631915L4.565999,20.665694 4.565999,48.4459C4.566,49.076302,5.0797424,49.587002,5.7100554,49.587002L14.742001,49.587002 14.742001,35.400336 18.161097,31.792807 18.166127,31.774705 26.474542,22.972 26.521163,22.972 29.953973,19.349999 38.822001,19.349999 38.822001,5.7076302C38.822001,5.0806808,38.309198,4.5669994,37.680792,4.5669994z M18.449971,0L37.680651,0C40.833681,0,43.391001,2.5571156,43.391001,5.707489L43.391001,19.349999 45.80884,19.349999C48.409018,19.35,50.517,21.458894,50.517,24.05704L50.517,59.292992C50.517,61.893593,48.409018,64,45.80884,64L19.448812,64C16.849223,64,14.742,61.893593,14.742001,59.292992L14.742001,54.153999 5.709774,54.153999C2.555994,54.153999,0,51.599316,0,48.445534L0,19.465691 4.1473293,15.090039 4.1532602,15.068708 14.229262,4.3929996 14.286199,4.3929996z")
            };
            CopyPath.RenderTransform = transformGroup;
            CopyViewbox.Child        = CopyPath;
            CopyHeader.Children.Add(CopyViewbox);
            Copy.Header = CopyHeader;
            Copy.Click += WPCopy;
            Paste       = new SfRadialMenuItem();
            Grid PasteHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox PasteViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path PastePath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("M31.948999,57.859001L45.188999,57.859001 45.188999,59.699001 31.948999,59.699001z M31.948999,51.950001L45.188999,51.950001 45.188999,53.791 31.948999,53.791z M28.396044,35.408001C28.009256,35.408001,27.689001,35.726357,27.689001,36.116974L27.689001,62.648006C27.689001,63.039406,28.009256,63.357002,28.396044,63.357002L48.248085,63.357002C48.638691,63.357002,48.957001,63.039406,48.957001,62.648006L48.957001,45.402447 43.671608,45.381203C39.153995,45.736,39.033001,41.642223,39.033001,41.642223L39.033001,35.408001z M28.395853,32.571999L40.336986,32.571999 42.92213,35.299999 42.958431,35.299999 49.212662,41.928822 49.216327,41.942017 51.790001,44.657917 51.790001,62.648022C51.790001,64.605804,50.204025,66.191002,48.247158,66.191002L28.395853,66.191002C26.438854,66.191002,24.853,64.605804,24.853,62.648022L24.853,36.116901C24.853,34.16061,26.438854,32.571999,28.395853,32.571999z M23.4165,2.7189999C21.472765,2.7190001 19.896,4.211246 19.896,6.0526261 19.896,7.8918042 21.472765,9.3859997 23.4165,9.3859997 25.360433,9.3859997 26.936998,7.8918042 26.936998,6.0526261 26.936998,4.211246 25.360433,2.7190001 23.4165,2.7189999z M23.4165,0C26.836176,0,29.627563,2.5418639,29.798687,5.7406974L29.806993,6.0519996 35.229999,6.0519996 35.229999,7.9879994 46.833999,7.9879994 46.833999,34.156097 41.895698,28.945999 41.695999,28.945999 41.695999,14.389 35.229999,14.389 35.229999,20.865 11.604001,20.865 11.604001,14.389 5.136998,14.389 5.136998,59.294998 21.228,59.294998 21.228,62.648151C21.228,63.142387,21.27823,63.625092,21.373855,64.091423L21.431106,64.338997 0,64.338997 0,7.9879994 11.604001,7.9879994 11.604001,6.0519996 17.026007,6.0519996 17.034315,5.7406974C17.205442,2.5418639,19.996919,0,23.4165,0z")
            };
            PastePath.RenderTransform = transformGroup;
            PasteViewbox.Child        = PastePath;
            PasteHeader.Children.Add(PasteViewbox);
            Paste.Header = PasteHeader;
            Paste.Click += WPPaste;
            Undo         = new SfRadialMenuItem();
            Grid UndoHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox UndoViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path UndoPath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("F1M1146.68,2290.95C1147.82,2288.38 1149.41,2286.02 1151.46,2283.97 1155.82,2279.6 1161.62,2277.2 1167.8,2277.2 1173.97,2277.2 1179.78,2279.6 1184.14,2283.97 1188.5,2288.33 1190.91,2294.14 1190.91,2300.31 1190.91,2306.49 1188.5,2312.29 1184.14,2316.65 1183.44,2317.34 1182.53,2317.69 1181.62,2317.69 1180.71,2317.69 1179.8,2317.34 1179.1,2316.65 1177.72,2315.26 1177.72,2313.01 1179.11,2311.62 1182.13,2308.6 1183.8,2304.58 1183.8,2300.31 1183.8,2296.04 1182.13,2292.02 1179.1,2289 1176.09,2285.97 1172.07,2284.31 1167.8,2284.31 1163.52,2284.31 1159.51,2285.97 1156.48,2289 1154.24,2291.24 1152.76,2294.03 1152.13,2297.06L1159.8,2305.64 1137.57,2305.64 1139.35,2282.74 1146.68,2290.95z")
            };
            UndoPath.RenderTransform = transformGroup;
            UndoViewbox.Child        = UndoPath;
            UndoHeader.Children.Add(UndoViewbox);
            Undo.Header = UndoHeader;
            Undo.Click += WPUndo;
            Redo        = new SfRadialMenuItem();
            Grid RedoHeader = new Grid()
            {
                Height = 75, Background = new SolidColorBrush(Colors.Transparent)
            };
            Viewbox RedoViewbox = new Viewbox()
            {
                Margin = new Thickness(18)
            };

            Windows.UI.Xaml.Shapes.Path RedoPath = new Windows.UI.Xaml.Shapes.Path()
            {
                Stretch = Stretch.Uniform,
                Height  = 26,
                Width   = 26,
                Fill    = new SolidColorBrush(Colors.Black),
                RenderTransformOrigin = new Point(0.5, 0.5),
                Data = PathXamlToGeometry("F1M1182.69,1926.92C1181.55,1924.36 1179.96,1921.99 1177.91,1919.94 1173.55,1915.58 1167.74,1913.17 1161.57,1913.17 1155.39,1913.17 1149.59,1915.58 1145.23,1919.94 1140.86,1924.31 1138.46,1930.11 1138.46,1936.28 1138.46,1942.46 1140.86,1948.26 1145.23,1952.62 1145.92,1953.32 1146.83,1953.66 1147.74,1953.66 1148.65,1953.66 1149.56,1953.32 1150.26,1952.62 1151.64,1951.24 1151.64,1948.99 1150.26,1947.59 1147.23,1944.57 1145.57,1940.56 1145.57,1936.28 1145.57,1932.01 1147.23,1927.99 1150.26,1924.97 1153.28,1921.94 1157.29,1920.28 1161.57,1920.28 1165.84,1920.28 1169.86,1921.94 1172.88,1924.97 1175.12,1927.21 1176.61,1930 1177.23,1933.04L1169.57,1941.62 1191.79,1941.62 1190.01,1918.71 1182.69,1926.92z")
            };
            RedoPath.RenderTransform = transformGroup;
            RedoViewbox.Child        = RedoPath;
            RedoHeader.Children.Add(RedoViewbox);
            Redo.Header = RedoHeader;
            Redo.Click += WPRedo;
            selectionmenu.Items.Add(Bold);
            selectionmenu.Items.Add(Italic);
            selectionmenu.Items.Add(Underline);
            selectionmenu.Items.Add(Cut);
            selectionmenu.Items.Add(Copy);
            selectionmenu.Items.Add(Paste);
            selectionmenu.Items.Add(Undo);
            selectionmenu.Items.Add(Redo);
        }
        public void Fill()
        {
            _currentPath.Fill = _foregroundBrush;
            ((PathGeometry)_currentPath.Data).Figures[_currentFigureIndex].IsFilled = true;
            ClosePath();
            _canvas.Children.Add(_currentPath);

            _currentPath = CreateNewPath();
        }