/// <summary> /// Event Handler for a center button tap, calling user-registered events and handling navigation (if enabled) /// </summary> /// <param name="s">Sending object</param> /// <param name="e">Event information</param> private void OnCenterButtonTapped(object s, TappedRoutedEventArgs e) { // If an event has been registered with the center button tap, call it CenterButtonTapped?.Invoke(this, e); if (PreviousPies.Count == 0) { TogglePie(); } if (PreviousPies.Count <= 0 || !IsCenterButtonNavigationEnabled) { return; } // a custom menu may have changed dragability. Ensure we are draggable, of using Floating var floatingParent = FindParent <Floating>(this); if (floatingParent != null) { floatingParent.ShouldManipulateChild = true; } // If we have a previous pie, we're going back to it ChangePie(this, PreviousPies[PreviousPies.Count - 1], false); PreviousPies.RemoveAt(PreviousPies.Count - 1); // We don't necessarily have the same amount of pies and center buttons. // Users can create submenues that don't bring their own center button if (PreviousButtons.Count <= 0) { return; } ChangeCenterButton(this, PreviousButtons.Pop(), false); }
/// <summary> /// Clears the current pie, removing all currently displayed slices. /// </summary> /// <param name="storePrevious">Should we store the pie (for back navigation)?</param> private void _clearPie(bool storePrevious) { // Store the current pie if (storePrevious) { var backupPie = new Pie(); foreach (var rmb in Pie.Slices) { backupPie.Slices.Add(rmb); } backupPie.SelectedItem = Pie.SelectedItem; PreviousPies.Add(backupPie); } // Delete the current slices Pie.Slices.Clear(); CustomRadialControlRoot.Children.Clear(); }