/// <summary> /// draw a circle (point) on both screens /// </summary> /// <param name="myLine"></param> /// <param name="stroke"></param> /// <param name="fill"></param> public static void Draw(Point2D myPoint, Brush stroke, Brush fill) { if (mainw != null) { Point2D myPoint1 = new Point2D(myPoint.X, myPoint.Y); myPoint1.X = myPoint.X + mainw.userCanvasWindow.canvas.Width / 2 - mainw.userCanvas.Width / 2; myPoint1.Y = myPoint.Y + mainw.userCanvasWindow.canvas.Height / 2 - mainw.userCanvas.Height / 2; CanvasUtil.DrawEllipse(mainw.userCanvasWindow.canvas, myPoint1.X, myPoint1.Y, 50, 50, stroke, fill, null, 5); Point2D myPoint2 = new Point2D(myPoint.X, myPoint.Y); myPoint2.X = myPoint1.X * mainw.presentationCanvasWindow.canvas.Width / mainw.userCanvasWindow.canvas.Width; myPoint2.Y = myPoint1.Y * mainw.presentationCanvasWindow.canvas.Height / mainw.userCanvasWindow.canvas.Height; CanvasUtil.DrawEllipse(mainw.presentationCanvasWindow.canvas, myPoint2.X, myPoint2.Y, 50, 50, stroke, fill, null, 5); } }
void Group.Draw(Canvas c) { if (UIManager.ShowSecondaryMenu) { if (!UIManager.inMenuSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; UIManager.inMenuSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; if (UIManager.FirstHandNumber == 2) { leftAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; } if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2) { leftSelected = true; } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { if (leftSelected) { UIManager.SelectedGroup = parent; } leftSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, parent.IsActive ? secondaryColor : Brushes.LightGray, fill, System.Windows.Media.Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, parent.IsActive ? secondaryColor : Brushes.LightGray, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage(((Group)this).Name); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage(parent.Name); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); } else if (UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected) { if (!inSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; inSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; double rightAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; double rightAreaY = UIManager.initialY; double upAreaX = UIManager.initialX; double upAreaY = UIManager.initialY - 1.25 * UIManager.SUBMENU_DIAMETER; double downAreaX = UIManager.initialX; double downAreaY = UIManager.initialY + 1.25 * UIManager.SUBMENU_DIAMETER; if (UIManager.FirstHand.X > rightAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < rightAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > rightAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < rightAreaY + UIManager.SUBMENU_DIAMETER / 2 && !selected) { selected = true; rightSelected = true; UIManager.RotateRight(); } else if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2 && !selected) { selected = true; leftSelected = true; UIManager.RotateLeft(); } else if (UIManager.FirstHand.X > upAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < upAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > upAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < upAreaY + UIManager.SUBMENU_DIAMETER / 2 && !selected) { selected = true; upSelected = true; UIManager.RotateUp(); } else if (UIManager.FirstHand.X > downAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < downAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > downAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < downAreaY + UIManager.SUBMENU_DIAMETER / 2 && !selected) { selected = true; downSelected = true; UIManager.RotateDown(); } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { selected = false; leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (rightSelected) { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (upSelected) { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (downSelected) { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage(((Group)this).Name); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage("left"); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); System.Windows.Controls.Image image2 = ImageUtil.GetResourceImage("right"); CanvasUtil.DrawImageInCircle(c, image2, UIManager.SUBMENU_DIAMETER, rightAreaX, rightAreaY); System.Windows.Controls.Image image3 = ImageUtil.GetResourceImage("up"); CanvasUtil.DrawImageInCircle(c, image3, UIManager.SUBMENU_DIAMETER, upAreaX, upAreaY); System.Windows.Controls.Image image4 = ImageUtil.GetResourceImage("down"); CanvasUtil.DrawImageInCircle(c, image4, UIManager.SUBMENU_DIAMETER, downAreaX, downAreaY); } else { inSession = false; UIManager.inMenuSession = false; leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } }
void Group.Draw(Canvas c) { if (UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected) { if (!UIManager.inMenuSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; UIManager.inMenuSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; double rightAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; double rightAreaY = UIManager.initialY; double upAreaX = UIManager.initialX; double upAreaY = UIManager.initialY - 1.25 * UIManager.SUBMENU_DIAMETER; double downAreaX = UIManager.initialX; double downAreaY = UIManager.initialY + 1.25 * UIManager.SUBMENU_DIAMETER; if (UIManager.FirstHand.X > rightAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < rightAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > rightAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < rightAreaY + UIManager.SUBMENU_DIAMETER / 2) { if (UIManager.MinimalScrollLock) { UIManager.ScrollRight(); } else if (!rightSelected) { UIManager.ToNextPage(); } rightSelected = true; leftSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2) { if (UIManager.MinimalScrollLock) { UIManager.ScrollLeft(); } else if (!leftSelected) { UIManager.ToPreviousPage(); } leftSelected = true; rightSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > upAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < upAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > upAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < upAreaY + UIManager.SUBMENU_DIAMETER / 2) { upSelected = true; leftSelected = false; rightSelected = false; downSelected = false; UIManager.ScrollUp(); } else if (UIManager.FirstHand.X > downAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < downAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > downAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < downAreaY + UIManager.SUBMENU_DIAMETER / 2) { downSelected = true; leftSelected = false; rightSelected = false; upSelected = false; UIManager.ScrollDown(); } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, secondaryColor); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (rightSelected) { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, secondaryColor); } else { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (upSelected) { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, secondaryColor); } else { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (downSelected) { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, secondaryColor); } else { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage(UIManager.MinimalScrollLock ? "scroll" : "navigate"); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage("left"); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); System.Windows.Controls.Image image2 = ImageUtil.GetResourceImage("right"); CanvasUtil.DrawImageInCircle(c, image2, UIManager.SUBMENU_DIAMETER, rightAreaX, rightAreaY); System.Windows.Controls.Image image3 = ImageUtil.GetResourceImage("up"); CanvasUtil.DrawImageInCircle(c, image3, UIManager.SUBMENU_DIAMETER, upAreaX, upAreaY); System.Windows.Controls.Image image4 = ImageUtil.GetResourceImage("down"); CanvasUtil.DrawImageInCircle(c, image4, UIManager.SUBMENU_DIAMETER, downAreaX, downAreaY); } else { UIManager.inMenuSession = false; leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } }
void Group.Draw(Canvas c) { if (/*UIManager.SecondHand != null &&*/ UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected) { if (!UIManager.inMenuSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; UIManager.inMenuSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; double rightAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; double rightAreaY = UIManager.initialY; double upAreaX = UIManager.initialX; double upAreaY = UIManager.initialY - 1.25 * UIManager.SUBMENU_DIAMETER; double downAreaX = UIManager.initialX; double downAreaY = UIManager.initialY + 1.25 * UIManager.SUBMENU_DIAMETER; if (UIManager.FirstHand.X > rightAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < rightAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > rightAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < rightAreaY + UIManager.SUBMENU_DIAMETER / 2) { rightSelected = true; leftSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2) { leftSelected = true; rightSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > upAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < upAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > upAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < upAreaY + UIManager.SUBMENU_DIAMETER / 2) { upSelected = true; leftSelected = false; rightSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > downAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < downAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > downAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < downAreaY + UIManager.SUBMENU_DIAMETER / 2) { downSelected = true; leftSelected = false; rightSelected = false; upSelected = false; } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { if (leftSelected && Groups[0].IsActive) { UIManager.SelectedGroup = Groups[0]; } else if (rightSelected && Groups[1].IsActive) { UIManager.SelectedGroup = Groups[1]; } else if (upSelected && Groups[2].IsActive) { UIManager.SelectedGroup = Groups[2]; } else if (downSelected && Groups[3].IsActive) { UIManager.SelectedGroup = Groups[3]; } leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[0].IsActive ? secondaryColor : Brushes.LightGray, fill, System.Windows.Media.Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[0].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (rightSelected) { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[1].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[1].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (upSelected) { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[2].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[2].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (downSelected) { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[3].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[3].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage(((Group)instance).Name); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage(Groups[0].Name); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); System.Windows.Controls.Image image2 = ImageUtil.GetResourceImage(Groups[1].Name); CanvasUtil.DrawImageInCircle(c, image2, UIManager.SUBMENU_DIAMETER, rightAreaX, rightAreaY); System.Windows.Controls.Image image3 = ImageUtil.GetResourceImage(Groups[2].Name); CanvasUtil.DrawImageInCircle(c, image3, UIManager.SUBMENU_DIAMETER, upAreaX, upAreaY); System.Windows.Controls.Image image4 = ImageUtil.GetResourceImage(Groups[3].Name); CanvasUtil.DrawImageInCircle(c, image4, UIManager.SUBMENU_DIAMETER, downAreaX, downAreaY); } else { UIManager.inMenuSession = false; leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } }
void Group.Draw(Canvas c) { if (UIManager.ShowSecondaryMenu) { if (!UIManager.inMenuSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; UIManager.inMenuSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; if (UIManager.FirstHandNumber == 2) { leftAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; } if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2) { leftSelected = true; } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { if (leftSelected) { UIManager.SelectedGroup = parent; } leftSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, parent.IsActive ? secondaryColor : Brushes.LightGray, fill, System.Windows.Media.Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, parent.IsActive ? secondaryColor : Brushes.LightGray, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage(((Group)this).Name); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage(parent.Name); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); } else if (UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected && GetElements().Count > 0 && !UIManager.inMenuSession) { if (!inSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; inSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.FirstHand.Y; double selX = UIManager.initialX; double selY = UIManager.initialY - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.FirstHand.Y; double rightAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; double rightAreaY = UIManager.FirstHand.Y; double selectionAreaX = c.Width / 2; double selectionAreaY = c.Height - UIManager.MENU_DIAMETER; double prevAreaX = selectionAreaX - 1.25 * UIManager.SUBMENU_DIAMETER; double prevAreaY = c.Height - UIManager.SUBMENU_DIAMETER; double nextAreaX = selectionAreaX + 1.25 * UIManager.SUBMENU_DIAMETER; double nextAreaY = c.Height - UIManager.SUBMENU_DIAMETER; if (UIManager.FirstHand.Y > selY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < selY + UIManager.SUBMENU_DIAMETER / 2 && selSelected == false) { selSelected = true; ExecuteSelect(); } else if (UIManager.FirstHand.X > rightAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < rightAreaX + UIManager.SUBMENU_DIAMETER / 2 && selection == false) { rightSelected = true; selection = true; IncrementIndex(); } else if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && selection == false) { leftSelected = true; selection = true; DecrementIndex(); } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2) { if (UIManager.FirstHand.Y >= selY + UIManager.SUBMENU_DIAMETER / 2) { selSelected = false; } selection = false; leftSelected = false; rightSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (rightSelected) { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } if (selSelected) { CanvasUtil.DrawEllipse(c, selX, selY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, selX, selY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, secondaryColor, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage("select"); CanvasUtil.DrawImageInCircle(c, image0, UIManager.SUBMENU_DIAMETER, selX, selY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage("left"); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); System.Windows.Controls.Image image2 = ImageUtil.GetResourceImage("right"); CanvasUtil.DrawImageInCircle(c, image2, UIManager.SUBMENU_DIAMETER, rightAreaX, rightAreaY); if (GetElements().Count > 2) { CanvasUtil.DrawImageInRectangle(c, GetPrevElement().Thumbnail, secondaryColor, prevAreaX, prevAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.3); CanvasUtil.DrawImageInRectangle(c, GetNextElement().Thumbnail, secondaryColor, nextAreaX, nextAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.3); CanvasUtil.DrawImageInRectangle(c, GetElement().Thumbnail, primaryColor, selectionAreaX, selectionAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.9); } else if (GetElements().Count == 2) { if (pageIndex == 0) { CanvasUtil.DrawImageInRectangle(c, GetNextElement().Thumbnail, secondaryColor, nextAreaX, nextAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.3); CanvasUtil.DrawImageInRectangle(c, GetElement().Thumbnail, primaryColor, selectionAreaX, selectionAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.9); } else { CanvasUtil.DrawImageInRectangle(c, GetPrevElement().Thumbnail, secondaryColor, prevAreaX, prevAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.3); CanvasUtil.DrawImageInRectangle(c, GetElement().Thumbnail, primaryColor, selectionAreaX, selectionAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.9); } } else if (GetElements().Count == 1) { CanvasUtil.DrawImageInRectangle(c, GetElement().Thumbnail, primaryColor, selectionAreaX, selectionAreaY, UIManager.SUBMENU_DIAMETER * 2, 0.9); } CanvasUtil.DrawTextBlock(c, GetElement().Name, 0.1 * UIManager.SUBMENU_DIAMETER * 2, System.Windows.Media.Brushes.White, primaryColor, selectionAreaX, selectionAreaY - 1.25 * UIManager.SUBMENU_DIAMETER); } else { inSession = false; UIManager.inMenuSession = false; selection = false; leftSelected = false; rightSelected = false; } }
void Group.Draw(Canvas c) { UIManager.Clear(); if (UIManager.ShowSecondaryMenu) { if (!UIManager.inMenuSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; UIManager.inMenuSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; if (UIManager.FirstHandNumber == 2) { leftAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; } if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2) { leftSelected = true; } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { if (leftSelected) { UIManager.SelectedGroup = UIManager.MainGroup; } leftSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, UIManager.MainGroup.IsActive ? secondaryColor : Brushes.LightGray, fill, System.Windows.Media.Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, UIManager.MainGroup.IsActive ? secondaryColor : Brushes.LightGray, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage(((Group)this).Name); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage(UIManager.MainGroup.Name); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); } else if (UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected && !UIManager.inMenuSession) { if (!inSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; inSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); Brush color = null; int i = 0; foreach (Point2D p in pointsLeft) { if (UIManager.FirstHandNumber == 1) { color = ColorUtil.FromHTML(colors[i]); } else { color = ColorUtil.FromHTML(colors[colors.Count - 1 - i]); } UIManager.Draw(p, color, Brushes.Transparent); i++; } if (pointsLeft.Count > 10) { pointsLeft.Dequeue(); } Point2D currentPoint = new Point2D(UIManager.FirstHand.X, UIManager.FirstHand.Y); pointsLeft.Enqueue(currentPoint); } else { pointsLeft.Clear(); inSession = false; UIManager.inMenuSession = false; leftSelected = false; } }
void Group.Draw(Canvas c) { if ((instance.brush == null || UIManager.inMenuSession || UIManager.ShowSecondaryMenu) && UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected) { UIManager.InPaint = false; if (!UIManager.inMenuSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; UIManager.inMenuSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; double rightAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; double rightAreaY = UIManager.initialY; double upAreaX = UIManager.initialX; double upAreaY = UIManager.initialY - 1.25 * UIManager.SUBMENU_DIAMETER; double downAreaX = UIManager.initialX; double downAreaY = UIManager.initialY + 1.25 * UIManager.SUBMENU_DIAMETER; if (UIManager.FirstHand.X > rightAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < rightAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > rightAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < rightAreaY + UIManager.SUBMENU_DIAMETER / 2) { rightSelected = true; leftSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2) { leftSelected = true; rightSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > upAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < upAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > upAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < upAreaY + UIManager.SUBMENU_DIAMETER / 2) { upSelected = true; leftSelected = false; rightSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > downAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < downAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > downAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < downAreaY + UIManager.SUBMENU_DIAMETER / 2) { downSelected = true; leftSelected = false; rightSelected = false; upSelected = false; } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { if (leftSelected && Groups[0].IsActive) { UIManager.SelectedGroup = Groups[0]; brush = null; } else if (rightSelected && Groups[1].IsActive) { UIManager.Clear(); } else if (upSelected && Groups[2].IsActive) { brush = ((PaintColor)Groups[2]).Brush; } else if (downSelected && Groups[3].IsActive) { brush = ((PaintColor)Groups[3]).Brush; } leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[0].IsActive ? secondaryColor : Brushes.LightGray, fill, System.Windows.Media.Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[0].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (rightSelected) { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[1].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[1].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (upSelected) { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[2].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[2].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (downSelected) { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[3].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[3].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage("paint"); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage(Groups[0].Name); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); System.Windows.Controls.Image image2 = ImageUtil.GetResourceImage(Groups[1].Name); CanvasUtil.DrawImageInCircle(c, image2, UIManager.SUBMENU_DIAMETER, rightAreaX, rightAreaY); System.Windows.Controls.Image image3 = ImageUtil.GetResourceImage(Groups[2].Name); CanvasUtil.DrawImageInCircle(c, image3, UIManager.SUBMENU_DIAMETER, upAreaX, upAreaY); System.Windows.Controls.Image image4 = ImageUtil.GetResourceImage(Groups[3].Name); CanvasUtil.DrawImageInCircle(c, image4, UIManager.SUBMENU_DIAMETER, downAreaX, downAreaY); } else if (UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected && !UIManager.inMenuSession) { if (!inSession) { initialX = UIManager.FirstHand.X; initialY = UIManager.FirstHand.Y; inSession = true; lastX = initialX; lastY = initialY; } if (brush != null) { UIManager.InPaint = true; UIManager.inMenuSession = false; CanvasUtil.DrawEllipse(c, UIManager.FirstHand.X, UIManager.FirstHand.Y, 40, 40, Brushes.Black, brush, brush); System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = initialX; double centerY = initialY; Point2D last = new Point2D(lastX, lastY); Point2D current = new Point2D(UIManager.FirstHand.X, UIManager.FirstHand.Y); if (GeometryUtil.GetDistance2D(last, current) > 50) { Line myLine = new Line(); myLine.Stroke = brush; myLine.X1 = lastX; myLine.X2 = UIManager.FirstHand.X; myLine.Y1 = lastY; myLine.Y2 = UIManager.FirstHand.Y; myLine.StrokeThickness = 10; UIManager.Draw(myLine); lastX = UIManager.FirstHand.X; lastY = UIManager.FirstHand.Y; } } } else { inSession = false; UIManager.inMenuSession = false; leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } if (brush != null) { String resource = "paint_"; if (brush.ToString().Equals("#FFFF0000")) { resource += "red"; } else if (brush.ToString().Equals("#FF0000FF")) { resource += "blue"; } else if (brush.ToString().Equals("#FF00FF00")) { resource += "green"; } else { resource += "orange"; } CanvasUtil.DrawEllipse(c, c.Width / 2, 75, 150, 150, ProfileManager.ActiveProfile.PrimaryColor, ColorUtil.FromHTML("#88FFFFFF"), Brushes.White); CanvasUtil.DrawImageInCircle(c, ImageUtil.GetResourceImage(resource), 150, c.Width / 2, 75); } }
void Group.Draw(Canvas c) { if (/*UIManager.SecondHand != null &&*/ UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected) { if (!UIManager.inMenuSession) { UIManager.initialX = UIManager.FirstHand.X; UIManager.initialY = UIManager.FirstHand.Y; UIManager.inMenuSession = true; } System.Windows.Media.Brush primaryColor = ProfileManager.ActiveProfile.PrimaryColor; System.Windows.Media.Brush secondaryColor = ProfileManager.ActiveProfile.SecondaryColor; System.Windows.Media.Brush fill = ColorUtil.FromHTML("#88FFFFFF"); double centerX = UIManager.initialX; double centerY = UIManager.initialY; double leftAreaX = UIManager.initialX - 1.25 * UIManager.SUBMENU_DIAMETER; double leftAreaY = UIManager.initialY; double rightAreaX = UIManager.initialX + 1.25 * UIManager.SUBMENU_DIAMETER; double rightAreaY = UIManager.initialY; double upAreaX = UIManager.initialX; double upAreaY = UIManager.initialY - 1.25 * UIManager.SUBMENU_DIAMETER; double downAreaX = UIManager.initialX; double downAreaY = UIManager.initialY + 1.25 * UIManager.SUBMENU_DIAMETER; if (UIManager.FirstHand.X > rightAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < rightAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > rightAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < rightAreaY + UIManager.SUBMENU_DIAMETER / 2) { rightSelected = true; leftSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > leftAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < leftAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > leftAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < leftAreaY + UIManager.SUBMENU_DIAMETER / 2) { leftSelected = true; rightSelected = false; upSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > upAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < upAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > upAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < upAreaY + UIManager.SUBMENU_DIAMETER / 2) { upSelected = true; leftSelected = false; rightSelected = false; downSelected = false; } else if (UIManager.FirstHand.X > downAreaX - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.X < downAreaX + UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y > downAreaY - UIManager.SUBMENU_DIAMETER / 2 && UIManager.FirstHand.Y < downAreaY + UIManager.SUBMENU_DIAMETER / 2) { downSelected = true; leftSelected = false; rightSelected = false; upSelected = false; } else if (UIManager.FirstHand.X > centerX - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.X < centerX + UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y > centerY - UIManager.MENU_DIAMETER / 2 && UIManager.FirstHand.Y < centerY + UIManager.MENU_DIAMETER / 2) { if (leftSelected && Groups[0].IsActive) { UIManager.SelectedGroup = Groups[0]; } else if (rightSelected && Groups[1].IsActive) { UIManager.CloseChart(); } else if (upSelected && Groups[2].IsActive) { UIManager.SelectedGroup = Groups[2]; } else if (downSelected && Groups[3].IsActive) { UIManager.SelectedGroup = Groups[3]; } leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } CanvasUtil.DrawEllipse(c, centerX, centerY, UIManager.MENU_DIAMETER, UIManager.MENU_DIAMETER, primaryColor, fill, null); if (leftSelected) { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[0].IsActive ? secondaryColor : Brushes.LightGray, fill, System.Windows.Media.Brushes.White); } else { CanvasUtil.DrawEllipse(c, leftAreaX, leftAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[0].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (rightSelected) { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[1].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, rightAreaX, rightAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[1].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (upSelected) { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[2].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, upAreaX, upAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[2].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } if (downSelected) { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[3].IsActive ? secondaryColor : Brushes.LightGray, fill, Brushes.White); } else { CanvasUtil.DrawEllipse(c, downAreaX, downAreaY, UIManager.SUBMENU_DIAMETER, UIManager.SUBMENU_DIAMETER, Groups[3].IsActive ? secondaryColor : Brushes.LightGray, fill, null); } System.Windows.Controls.Image image0 = ImageUtil.GetResourceImage(((Group)instance).Name); CanvasUtil.DrawImageInCircle(c, image0, UIManager.MENU_DIAMETER, centerX, centerY); System.Windows.Controls.Image image1 = ImageUtil.GetResourceImage(Groups[0].Name); CanvasUtil.DrawImageInCircle(c, image1, UIManager.SUBMENU_DIAMETER, leftAreaX, leftAreaY); System.Windows.Controls.Image image2 = ImageUtil.GetResourceImage(Groups[1].Name); CanvasUtil.DrawImageInCircle(c, image2, UIManager.SUBMENU_DIAMETER, rightAreaX, rightAreaY); System.Windows.Controls.Image image3 = ImageUtil.GetResourceImage(Groups[2].Name); CanvasUtil.DrawImageInCircle(c, image3, UIManager.SUBMENU_DIAMETER, upAreaX, upAreaY); System.Windows.Controls.Image image4 = ImageUtil.GetResourceImage(Groups[3].Name); CanvasUtil.DrawImageInCircle(c, image4, UIManager.SUBMENU_DIAMETER, downAreaX, downAreaY); } else { UIManager.inMenuSession = false; leftSelected = false; rightSelected = false; upSelected = false; downSelected = false; } /* * if (UIManager.SecondHand != null && UIManager.FirstHandNumber != 0 && UIManager.FirstHand.IsSelected) { * * double centerX = ( UIManager.FirstHand.X + UIManager.SecondHand.X ) / 2; * double centerY = ( UIManager.FirstHand.Y + UIManager.SecondHand.Y ) / 2; * * Double delta = Math.Abs(UIManager.Delta) + 1; * * Double centerDiameter = Math.Sqrt(Math.Pow(UIManager.FirstHand.X - UIManager.SecondHand.X, 2) + Math.Pow(UIManager.FirstHand.Y - UIManager.SecondHand.Y, 2)) - 150; * * if (centerDiameter > 2 * ( 1.75 * delta - 225 )) { * centerDiameter = 2 * ( 1.75 * delta - 225 ); * } * if (centerDiameter <= 0) { * centerDiameter = 1; * } * * double rightAreaX = UIManager.RightHand.X; * double rightAreaY = UIManager.LeftHand.Y; * * if (rightAreaX > centerX + 1.75 * delta - 150) { * rightAreaX = centerX + 1.75 * delta - 150; * } * * double rightSelectionX = centerX + 1.75 * delta; * double rightSelectionY = centerY; * * double leftSelectionX = centerX - 1.75 * delta; * double leftSelectionY = centerY; * * double leftAreaX = UIManager.LeftHand.X; * double leftAreaY = UIManager.RightHand.Y; * * if (leftAreaX < centerX - 1.75 * delta + 150) { * leftAreaX = centerX - 1.75 * delta + 150; * } * * if (UIManager.LeftHand.X < leftSelectionX + 75 && UIManager.LeftHand.Y < leftSelectionY + 75 && UIManager.LeftHand.Y > leftSelectionY - 75) { * preSelected = true; * } else if (UIManager.LeftHand.X > leftSelectionX + 150 && UIManager.LeftHand.Y < leftSelectionY + 75 && UIManager.LeftHand.Y > leftSelectionY - 75) { * if (preSelected) { * if (Groups[pos].Name.Equals("close")) { * UIManager.CloseChart(); * } else { * UIManager.SelectedGroup = Groups[pos]; * } * preSelected = false; * pos = 0; * posChanged = false; * } * } else if (preSelected && ( UIManager.LeftHand.Y >= leftSelectionY + 75 || UIManager.LeftHand.Y <= leftSelectionY - 75 )) { * preSelected = false; * } * * if (UIManager.LeftHand.Y > leftAreaY - 75 && UIManager.LeftHand.Y < leftAreaY + 75) { * posChanged = false; * } else if (UIManager.LeftHand.Y <= leftAreaY - 75 && !preSelected) { * IncrementPos(); * posChanged = true; * } else if (UIManager.LeftHand.Y >= leftAreaY + 75 && !preSelected) { * DecrementPos(); * posChanged = true; * } * * String caption = null; * if (GetSubmenu().Equals(UIManager.MainGroup.Name)) { * caption = "back 2 " + GetSubmenu(); * } * * CanvasUtil.DrawSubmenu(c, GetSubmenu(), caption, true, null, centerX, centerY, centerDiameter, 150, leftAreaX, leftAreaY, rightAreaX, rightAreaY, leftSelectionX, leftSelectionY, rightSelectionX, rightSelectionY, preSelected); * }*/ }