예제 #1
0
        private void SetupWizard(WizardControllerViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }

            if (_currentViewModel != null)
            {
                DisconnectCurrentModel();
            }

            ConnectViewModel(viewModel);
        }
예제 #2
0
        void ConnectViewModel(WizardControllerViewModel viewModel)
        {
            if (viewModel == null)
            {
                throw new ArgumentNullException(nameof(viewModel));
            }
            _currentViewModel = viewModel;
            _currentViewModel.StartWizard();

            foreach (var pageViewModel in viewModel.PageModels)
            {
                var pageView = _viewFactory.CreatePage(pageViewModel);
                Children.Add(pageView);
            }

            _currentViewModel.Current.ObserveOn(Scheduler.UiScheduler).Subscribe((vm) =>
            {
                var viewIndex = _currentViewModel.GetPageIndex(vm);
                var view      = Children[viewIndex];
                CurrentPage   = view;
            });
        }