public async Task PushAsync <T>() where T : IPageViewModel
        {
            var model = _viewModelFactory.CreateModel <T>();
            var view  = _viewFactory.CreatePage(model);

            await InitialisePage(view, model);
        }
Example #2
0
        public void Init()
        {
            _hotfixService.ApplyHotfixes();

            _mainViewModel.Init();

            InitializeComponent();
            MainPage = _viewFactory.CreatePage(_mainViewModel);
        }
Example #3
0
        private void ConnectMasterViewModel(NavigationControllerViewModel viewModel)
        {
            _viewModel = viewModel;

            if (_viewModel.CurrentPage == null)
            {
                throw new NotSupportedException("You must specify a current page for the master navigation controller.");
            }

            BarBackgroundColor = viewModel.NavigationBarColour;
            BarTextColor       = viewModel.NavigationBarTextColour;
            this.SetBinding(BarBackgroundColorProperty, "NavigationBarColour");
            this.SetBinding(BarTextColorProperty, "NavigationBarTextColour");

            var page = _viewFactory.CreatePage(_viewModel.CurrentPage);

            PushAsync(page);
        }
        private void ConnectMasterViewModel(ITabbedNavigationControllerViewModel viewModel)
        {
            _viewModel         = viewModel;
            BarBackgroundColor = viewModel.NavigationBarColour;
            BarTextColor       = viewModel.NavigationBarTextColour;

            this.SetBinding(BarBackgroundColorProperty, "NavigationBarColour");
            this.SetBinding(BarTextColorProperty, "NavigationBarTextColour");

            _viewModel.Pages.ForEach(p =>
            {
                var page = _viewFactory.CreatePage(p);
                _pageMap.Add(page, p);
                Children.Add(page);
            });
            CurrentPage = Children[0];
            //if (_viewModel.CurrentPage == null) throw new NotSupportedException("You must specify a current page for the master navigation controller.");
        }
Example #5
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;
            });
        }