void Destroy() { if (ShellItem != null) { UnhookEvents(ShellItem); } ((IShellController)ShellContext?.Shell)?.RemoveAppearanceObserver(this); if (_bottomSheetDialog != null) { _bottomSheetDialog.DismissEvent -= OnMoreSheetDismissed; _bottomSheetDialog?.Dispose(); _bottomSheetDialog = null; } _navigationArea?.Dispose(); _appearanceTracker?.Dispose(); _outerLayout?.Dispose(); if (_bottomView != null) { _bottomView?.SetOnNavigationItemSelectedListener(null); _bottomView?.Background?.Dispose(); _bottomView?.Dispose(); } _bottomView = null; _navigationArea = null; _appearanceTracker = null; _outerLayout = null; }
protected virtual void OnMoreItemSelected(ShellSection shellSection, BottomSheetDialog dialog) { ChangeSection(shellSection); dialog.Dismiss(); dialog.Dispose(); }
protected virtual void OnMoreItemSelected(ShellSection shellSection, BottomSheetDialog dialog) { ChangeSection(shellSection); dialog.Dismiss(); //should trigger OnMoreSheetDismissed, which will clean up the dialog if (dialog != _bottomSheetDialog) //should never be true, but just in case, prevent a leak { dialog.Dispose(); } }
protected virtual void OnMoreSheetDismissed(object sender, EventArgs e) { OnShellSectionChanged(); if (_bottomSheetDialog != null) { _bottomSheetDialog.DismissEvent -= OnMoreSheetDismissed; _bottomSheetDialog.Dispose(); _bottomSheetDialog = null; } }
void OnMoreItemSelected(int selectedIndex, BottomSheetDialog dialog) { if (selectedIndex >= 0 && _bottomNavigationView.SelectedItemId != selectedIndex && Element.Children.Count > selectedIndex) { Element.CurrentPage = Element.Children[selectedIndex]; } dialog.Dismiss(); dialog.DismissEvent -= OnMoreSheetDismissed; dialog.Dispose(); }