public override bool Execute() { mPresenter = mContainer.Resolve<IPresenter>(); string cPageException = "Cannot create page"; var menuVmDef = new ViewModelDefinition(); menuVmDef.AddQuality<MenuQuality>(); menuVmDef.AddQuality<MyQuality>(); var mainChildVmDef = new ViewModelDefinition(); mainChildVmDef.AddQuality<MainChildQuality>(); try { mViewModelManager.RegisterPageForViewModel<FirstViewModel, FirstPage>(mainChildVmDef); } catch (Exception e) when (e.Message.StartsWith(cPageException)) { } try { mViewModelManager.RegisterPageForViewModel<SecondViewModel, SecondPage>(menuVmDef); } catch (Exception e) when (e.Message.StartsWith(cPageException)) { } // show var first = mPresenter.Show<FirstViewModel>().Result; if (first == null || !first.NavTo) { return false; } var second = mPresenter.Show( def => def.HasQuality<MyQuality>()) .Result as SecondViewModel; if (second == null || !second.NavTo) { return false; } // close second = mPresenter.Close( x => x.HasQuality<MyQuality>()) .Result as SecondViewModel; if (second == null || !second.NavFrom) { return false; } first = mPresenter.Close<FirstViewModel>().Result; if (first == null || !first.NavFrom) { return false; } // TODO : find way to test alerts //return PathwayCore.DisplayAlertAsync("Alert", "Are you sure?", "Ok").Result; return true; }
/// <summary> /// Handles the jump to an URL initiated by the user through either <see cref="IHistoryPanelPresenter"/> or <see cref="IFavoritesPanelPresenter"/> /// </summary> /// <param name="sender">Sender of the event</param> /// <param name="e">Contains the URL to jump to</param> private void JumpAskedEventHandler(object sender, JumpAskedEventArgs e) { IPresenter origin = (IPresenter)sender; origin.Close(); this.mainController.InitiateJump(e.jumpTo); }