public void AddState <TView>(TState state, params TState[] permittedAncestors) where TView : Control { _flows.Add( state, new NavigationFlow <TState>( state, () => _navigationController.Navigate <TView>(), permittedAncestors)); BaseViewModelExtensions.CreateGlobalCommand( typeof(TState).Name + "_" + state.ToString(), async ct => _navigationController.Navigate <TView>(), // TODO: Observe navigation stack. Observable.Return(true)); }
protected override void OnRegisterViewModels(IViewModelController viewModels) { viewModels.RegisterViewModel <MainPage, Models.MainPageViewModel>(); viewModels.RegisterViewModel <GettingStartedPage, Models.GettingStartedPageViewModel>(); viewModels.RegisterViewModel <MessageAndDialogExamplesPage, Models.MessageAndDialogExamplesPageViewModel>(); // Just an example of global properties BaseViewModelExtensions.CreateGlobalProperty( "DateAndTime", () => Observable .Timer(TimeSpan.FromSeconds(1), TimeSpan.FromSeconds(1)) .Select(_ => DateTimeOffset.Now.ToString()), "-"); // Dialogs must also be registered by name. // TODO: It's wrong to be there, and be on extensions. BaseViewModelExtensions.RegisterDialog <ExampleDialog>("ExampleDialog"); }