public override void ReplacePageRoot(Page existingPage, Page page, MvxPagePresentationAttribute attribute) { if (existingPage == this.FormsApplication.MainPage) { FormsApplication.MainPage = page; } }
protected virtual Task <bool> ShowPageViewController( UIViewController viewController, MvxPagePresentationAttribute attribute, MvxViewModelRequest request) { if (PageViewController == null) { throw new MvxException("Trying to show a page without a PageViewController, this is not possible!"); } /*if (viewController is IMvxTabBarItemViewController tabBarItem) * { * attribute.TabName = tabBarItem.TabName; * attribute.TabIconName = tabBarItem.TabIconName; * attribute.TabSelectedIconName = tabBarItem.TabSelectedIconName; * }*/ if (attribute.WrapInNavigationController) { viewController = CreateNavigationController(viewController); } PageViewController.AddPage( viewController, attribute); return(Task.FromResult(true)); }
public override ValueTask <MvxBasePresentationAttribute?> CreatePresentationAttribute(Type?viewModelType, Type?viewType) { MvxLog.Instance.Trace($"PresentationAttribute not found for {viewType?.Name}. Assuming new page presentation"); var attribute = new MvxPagePresentationAttribute() { ViewType = viewType, ViewModelType = viewModelType }; return(new ValueTask <MvxBasePresentationAttribute?>(attribute)); }
public virtual void AddPage(UIViewController viewController, MvxPagePresentationAttribute attribute) { // add Page Pages.Add(viewController); // Start the ui page view controller when we add the first page if (Pages.Count == 1) { SetViewControllers(Pages.ToArray(), UIPageViewControllerNavigationDirection.Forward, true, null); } }
protected virtual Page CloseAndCreatePage(Type view, MvxViewModelRequest request, MvxPagePresentationAttribute attribute, bool closeModal = true, bool closePlatformViews = true, bool showPlatformViews = true) { if (closeModal) { CloseAllModals(); } if (closePlatformViews) { ClosePlatformViews?.Invoke(); } if (showPlatformViews) { ShowPlatformHost?.Invoke(attribute.HostViewModelType); } return(CreatePage(view, request, attribute)); }
protected virtual async Task <Page> CloseAndCreatePage(Type view, MvxViewModelRequest request, MvxPagePresentationAttribute attribute, bool closeModal = true, bool closePlatformViews = true, bool showPlatformViews = true) { if (closeModal) { await CloseAllModals(); } if (closePlatformViews) { PlatformPresenter.ClosePlatformViews(); } if (showPlatformViews) { PlatformPresenter.ShowPlatformHost(attribute.HostViewModelType); } return(CreatePage(view, request, attribute)); }
protected virtual Task <bool> ClosePageViewController(IMvxViewModel viewModel, MvxPagePresentationAttribute attribute) { if (PageViewController != null && PageViewController.RemovePage(viewModel)) { return(Task.FromResult(true)); } return(Task.FromResult(false)); }
private MvxPagePresentationAttribute GetPresenterAttribue(Type type) { return(_presenterAttribute = (MvxPagePresentationAttribute)type.GetCustomAttributes(true).First(a => a.GetType().Namespace.StartsWith("MvvmCross", StringComparison.OrdinalIgnoreCase))); }
public override void ReplacePageRoot(Xamarin.Forms.Page existingPage, Xamarin.Forms.Page page, MvxPagePresentationAttribute attribute) { try { base.ReplacePageRoot(existingPage, page, attribute); } catch (Exception e) { Logger.Log(MvxLogLevel.Debug, () => e.ToString()); } }