예제 #1
0
        /// <summary>
        ///     Change the current pie by replacing its PieSlices with new ones. If storePrevious is set to true,
        ///     the current pie will be stored away and restored during back navigation.
        /// </summary>
        /// <remarks>This method is used to facilitate the transition between RadialMenus.</remarks>
        /// <param name="s">Sending object</param>
        /// <param name="newPie">Pie object to take RadialMenuButtons from</param>
        /// <param name="storePrevious">Should we store the previous pie (for back navigation)?</param>
        public async void ChangePie(object s, Pie newPie, bool storePrevious)
        {
            BackgroundEllipse.Visibility = Visibility.Visible;

            foreach (var ps in Pie.PieSlices)
            {
                ps.OuterArcElement.Visibility = Visibility.Collapsed;
            }

            // Play animations, depending on what's in the control
            if (CustomRadialControlRoot.Children.Count > 0)
            {
                if (IsMenuChangeAnimated)
                {
                    await CustomPieExitForChangeStoryboard.PlayAsync();
                }
            }
            else
            {
                if (IsMenuChangeAnimated)
                {
                    await PieExitForChangeStoryboard.PlayAsync();
                }
            }

            _clearPie(storePrevious);
            // Add the new ones
            foreach (var rmb in newPie.Slices)
            {
                Pie.Slices.Add(rmb);
            }

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

            // Ensure that we remember what the last selected item was
            Pie.SelectedItem = newPie.SelectedItem ?? null;

            if (IsMenuChangeAnimated)
            {
                await PieEnterForChangeStoryboard.PlayAsync();
            }
            BackgroundEllipse.Visibility = Visibility.Collapsed;
        }
예제 #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;
        }