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; } }