Baconit.PanelManager.GoBack C# (CSharp) Method

GoBack() public method

Fired when the user presses the back button.
public GoBack ( ) : bool
return bool
        public bool GoBack()
        {
            bool handled = false;

            // If we can go back, do it.
            if(CanGoBack())
            {
                // Call go back but this might not work, we can't go back while something else is navigating.
                // If we can't go back right now just silently ignore the request.
                bool? wentBack = GoBack_Internal();

                // If null was returned we are animating a navigation so just ignore this.
                if(!wentBack.HasValue)
                {
                    handled = true;
                }
                // If we got true then we actually did go back.
                else if(wentBack.Value)
                {
                    handled = true;
                }
                // If we get false we can't go back and din't go anything.
                else
                {
                    handled = false;
                }
            }

            if(!handled)
            {
                // If we can't go back anymore for the last back show the menu.
                // After that let the user leave.
                if(!m_finalNavigateHasShownMenu)
                {
                    m_finalNavigateHasShownMenu = true;
                    handled = true;
                    ToggleMenu(true);
                }
            }

            return handled;
        }

Usage Example

Example #1
0
 /// <summary>
 /// Called by the action listener when we should nav back
 /// </summary>
 public bool NavigateBack()
 {
     return(m_panelManager.GoBack());
 }