Esempio n. 1
0
        private void Compose()
        {
            // @TODO(Joy)DONE: Go through each MenuItemInfo, get it to draw itself.
            if (null == visibleMenuItems || (visibleMenuItems.Count <= 0))
            {
                return;
            }
            DrawingContext context = radialMenuVisual.RenderOpen();

            //Rect hitTestArea = new Rect(new Point(0, -140), new Size(300, arcEndPoint.Y - arcStartPoint.Y));
            //LinearGradientBrush brush = new LinearGradientBrush(Colors.Red, Colors.Black, 0);
            ////context.DrawRectangle(Brushes.Transparent, null, hitTestArea);
            //Drawing drawing = new GeometryDrawing();

            //context.DrawRectangle(Brushes.Transparent, null, hitTestArea);
            AddEffect();
            int  itemsCount = visibleMenuItems.Count;
            Rect background = new Rect(new Size(150, 150));

            if (nodePart == NodePart.NorthEast)
            {
                background.Location = new Point(this.radius / 2, -(arcEndPoint.Y - arcStartPoint.Y) / 2 - background.Height / 2);
            }
            else if (nodePart == NodePart.North)
            {
                background.Location = new Point(-this.radius / 2 - background.Width, arcEndPoint.Y - 20);
            }
            context.DrawRectangle(Brushes.Transparent, null, background);
            foreach (MenuItemInfo item in visibleMenuItems)
            {
                item.Render(context, fadeFlag);
            }

            DrawArc(context);

            //Rect topScrollerBackground = new Rect(new Size(100, 50));
            //Rect bottomScrollerBackground = new Rect(new Size(100, 50));
            //topScrollerBackground.Location = arcStartPoint;
            //bottomScrollerBackground.Location = arcEndPoint;
            //context.DrawRectangle(Brushes.Yellow, null, topScrollerBackground);
            //context.DrawRectangle(Brushes.Yellow, null, bottomScrollerBackground);
            //Rect startTest = new Rect(arcStartPoint, new Size(5, 5));
            //Rect endTest = new Rect(arcEndPoint, new Size(5, 5));
            //Rect centerTest = new Rect(centerPosition, new Size(5, 5));
            //context.DrawRectangle(Brushes.SkyBlue, null, startTest);
            //context.DrawRectangle(Brushes.Firebrick, null, endTest);
            //context.DrawRectangle(Brushes.Black, null, centerTest);
            //DrawScroller(context, upScroller);
            //DrawScroller(context, downScroller);
            if (upScroller != null && downScroller != null)
            {
                upScroller.Render(context);
                downScroller.Render(context);
            }
            context.Close();
        }