-
-
Save dellis1972/8396970 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public abstract class ViewModelBase : MvxViewModel | |
{ | |
protected void ClearStackAndShowViewModel<TViewModel>() | |
where TViewModel : ViewModelBase | |
{ | |
var presentationBundle = new MvxBundle(new Dictionary<string, string> { { PresentationBundleFlagKeys.ClearStack, "" } }); | |
ShowViewModel<TViewModel>(presentationBundle: presentationBundle); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class PresentationBundleFlagKeys | |
{ | |
public const string ClearStack = "__CLEAR_STACK__"; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SlidingMenuViewPresenter : MvxModalNavSupportTouchViewPresenter | |
{ | |
public override void Show(MvxViewModelRequest request) | |
{ | |
if (request.PresentationValues != null) | |
{ | |
if (request.PresentationValues.ContainsKey(PresentationBundleFlagKeys.ClearStack)) | |
{ | |
var nextViewController = (UIViewController)ViewCreator.CreateView(request); | |
if (MasterNavigationController.TopViewController.GetType() != nextViewController.GetType()) | |
{ | |
MasterNavigationController.PopToRootViewController(false); | |
MasterNavigationController.PushViewController(nextViewController, false); | |
} | |
return; | |
} | |
} | |
base.Show(request); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment