public BuildArcTowardsCenter ( int diameter, int arcThickness, Windows color, int gap, double angleStart, double angleEnd, bool showArrow = true ) : void | ||
diameter | int | |
arcThickness | int | |
color | Windows | |
gap | int | |
angleStart | double | |
angleEnd | double | |
showArrow | bool | |
리턴 | void |
private void DoArcMenuItemSelectedMessageCallback(ArcMenuItemSelectedMessage msg) { if (msg.Identifier != "AMS") return; if (isShowingSubMenu) { //Remove all Submenu items foreach (var arc in _arcs) { if (arc.ParentMenuId != 0) arc.Unload(); } //Show all main menu items foreach (var arc in _arcs) { if (arc.ParentMenuId == 0) arc.Visibility = Visibility.Visible; } } else { //Hide main Menu items not related to the main menu item selected foreach (var arc in _arcs) { if (arc.ParentMenuId == 0 && arc.MenuId != int.Parse(msg.Content)) arc.Visibility = Visibility.Collapsed; } //Remove all Submenu items if there are any _arcs.RemoveAll(x=>x.ParentMenuId!=0); //Get ParentArc var parentArc = _arcs.Where(x => x.MenuId == int.Parse((string)msg.Content)).First(); //show submenu if (parentArc.MenuId == 1) { double startAngle = parentArc.AngleStart; Arc arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = parentArc.MenuId; arcChild.MenuId = 10; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Purple, 2, startAngle, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 11; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Yellow, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 12; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Orange, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); } else if (parentArc.MenuId == 2) { double startAngle = parentArc.AngleStart; Arc arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = parentArc.MenuId; arcChild.MenuId = 10; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Purple, 2, startAngle, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 11; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Purple, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); } else if (parentArc.MenuId == 3) { double startAngle = parentArc.AngleStart; Arc arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = parentArc.MenuId; arcChild.MenuId = 10; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 11; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 12; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 13; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); } } isShowingSubMenu = !isShowingSubMenu; }
private void DoArcMenuItemSelectedMessageCallback(ArcMenuItemSelectedMessage msg) { if (msg.Identifier != "AMS") { return; } if (isShowingSubMenu) { //Remove all Submenu items foreach (var arc in _arcs) { if (arc.ParentMenuId != 0) { arc.Unload(); } } //Show all main menu items foreach (var arc in _arcs) { if (arc.ParentMenuId == 0) { arc.Visibility = Visibility.Visible; } } } else { //Hide main Menu items not related to the main menu item selected foreach (var arc in _arcs) { if (arc.ParentMenuId == 0 && arc.MenuId != int.Parse(msg.Content)) { arc.Visibility = Visibility.Collapsed; } } //Remove all Submenu items if there are any _arcs.RemoveAll(x => x.ParentMenuId != 0); //Get ParentArc var parentArc = _arcs.Where(x => x.MenuId == int.Parse((string)msg.Content)).First(); //show submenu if (parentArc.MenuId == 1) { double startAngle = parentArc.AngleStart; Arc arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = parentArc.MenuId; arcChild.MenuId = 10; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Purple, 2, startAngle, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 11; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Yellow, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 12; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Orange, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); } else if (parentArc.MenuId == 2) { double startAngle = parentArc.AngleStart; Arc arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = parentArc.MenuId; arcChild.MenuId = 10; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Purple, 2, startAngle, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 11; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Purple, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); } else if (parentArc.MenuId == 3) { double startAngle = parentArc.AngleStart; Arc arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = parentArc.MenuId; arcChild.MenuId = 10; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 11; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 12; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); startAngle += 44; arcChild = new Arc(layoutRoot.ActualWidth, layoutRoot.ActualHeight); arcChild.ParentMenuId = int.Parse((string)msg.Content); arcChild.MenuId = 13; arcChild.BuildArcTowardsCenter(DefaultOuterDiameter, 60, Windows.UI.Colors.Gray, 2, startAngle + 1, startAngle + 44, false); grdButtons.Children.Add(arcChild); _arcs.Add(arcChild); } } isShowingSubMenu = !isShowingSubMenu; }