示例#1
0
        /// <summary>
        ///     Change the whole radial menu, using a new menu object.
        /// </summary>
        /// <remarks>This method is used to facilitate the transition between a parent and a submenu.</remarks>
        /// <param name="s">Sending object</param>
        /// <param name="menu">Menu to change to</param>
        public void ChangeMenu(object s, MenuBase menu)
        {
            if (menu is RadialMenu)
            {
                var radialMenu = (RadialMenu)menu;
                ChangePie(s, radialMenu.Pie, true);
                ChangeCenterButton(s, Helpers.ButtonToShim(radialMenu.CenterButton, radialMenu.CenterButtonTapped),
                                   true);
            }
            else
            {
                ChangeToCustomMenu(s, menu, true);
                ChangeCenterButton(s, Helpers.ButtonToShim(menu.CenterButton), true);
            }

            var floatingParent = FindParent <Floating>(this);

            if (floatingParent != null)
            {
                floatingParent.ShouldManipulateChild = menu.IsDraggable;
            }
        }
示例#2
0
        /// <summary>
        ///     Change to custom MenuBase menu.
        /// </summary>
        /// <param name="s">Sending object</param>
        /// <param name="newSubMenu">The new submenu which will be placed in customRadialControlRoot Canvas</param>
        /// <param name="storePrevious">Should we store the previous pie (for back navigation)?</param>
        public async void ChangeToCustomMenu(object s, MenuBase newSubMenu, bool storePrevious)
        {
            BackgroundEllipse.Visibility = Visibility.Visible;
            if (IsMenuChangeAnimated)
            {
                await PieExitForChangeStoryboard.PlayAsync();
            }

            _clearPie(storePrevious);

            // Redraw
            Pie.Draw();
            Pie.UpdateLayout();

            newSubMenu.Diameter = Diameter;
            CustomRadialControlRoot.Children.Add(newSubMenu);

            // Check if we're in a MeterSubMenu
            if (newSubMenu is MeterSubMenu)
            {
                var newMeterSubMenu   = newSubMenu as MeterSubMenu;
                var defaultBackground = (HasBackgroundEllipse)
                    ? new SolidColorBrush(BackgroundEllipseFill)
                    : new SolidColorBrush(InnerNormalColor);
                newMeterSubMenu.SetDefault(MeterSubMenu.BackgroundFillBrushProperty, defaultBackground);
                newMeterSubMenu.SetDefault(MeterSubMenu.OuterEdgeBrushProperty, new SolidColorBrush(OuterDisabledColor));
                newMeterSubMenu.SetDefault(MeterSubMenu.OuterEdgeThicknessProperty, OuterThickness);
            }

            newSubMenu.UpdateLayout();

            if (IsMenuChangeAnimated)
            {
                await CustomPieEnterForChangeStoryboard.PlayAsync();
            }
            BackgroundEllipse.Visibility = Visibility.Collapsed;
        }
示例#3
0
 private void OnChangeMenuRequest(object s, MenuBase sm)
 {
     ChangeMenuRequestEvent?.Invoke(s, sm);
 }