Catel.Services.UIVisualizerService.OnBackButtonPressed C# (CSharp) Method

OnBackButtonPressed() private method

private OnBackButtonPressed ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private async void OnBackButtonPressed(object sender, EventArgs e)
        {
            var contentPage = sender as ContentPage;
            if (contentPage != null)
            {
                var popupLayout = contentPage.Content as PopupLayout;
                if (popupLayout != null && popupLayout.IsPopupActive)
                {
                    _callbacks[contentPage]?.Item2?.SafeInvoke(this, new UICompletedEventArgs(_callbacks[contentPage].Item1, null));
                    await popupLayout.DismissPopup();
                }

                if (popupLayout == null)
                {
                    _callbacks[contentPage]?.Item2?.SafeInvoke(this, new UICompletedEventArgs(_callbacks[contentPage].Item1, null));
                    await NavigationHelper.PopModalAsync(); 
                }
                
                contentPage.BackButtonPressed -= OnBackButtonPressed;
            }
        }
    }