Example #1
0
        private async void Proceed( )
        {
            // Ensure that the guideline runner has this block as the current block.
            GuidelineRunner.SetCurrentBlock(Block);

            // Move to the next block in the guideline.
            var nextBlock = GuidelineRunner.MoveForwards();

            // Navigate to a page with that next block.
            var navigationModel = new GuidelinePageNavigationModel
            {
                CurrentBlock           = nextBlock,
                CurrentGuidelineRunner = GuidelineRunner
            };
            await _navigationService.NavigateAsync("GuidelinePage", navigationModel.ToNavigationParameters());
        }
Example #2
0
        private async void StartGuideline( )
        {
            try
            {
                // Retrieve the guideline from the remote server.
                IGuidelineRetriever guidelineRetriever = new AzureRemoteGuidelineRetriever();
                var guideline = await guidelineRetriever.RetrieveGuidelineAsync(Identifier);

                // Start running that guideline.
                IGuidelineRunner guidelineRunner = new DefaultGuidelineRunner(guideline, _eventAggregator);
                var startBlock      = guidelineRunner.Start();
                var navigationModel = new GuidelinePageNavigationModel
                {
                    CurrentBlock           = startBlock,
                    CurrentGuidelineRunner = guidelineRunner
                };
                await _navigationService.NavigateAsync("GuidelinePage", navigationModel.ToNavigationParameters());
            }
            catch (Exception exception)
            {
                throw;
            }
        }
Example #3
0
        private void Initiate(NavigationParameters parameters)
        {
            // If the page is not currently associated with anything, then load the data.
            // Note that if the user presses the back button, then the page will still have the data associated with it.
            if ((Block == null) || (GuidelineRunner == null))
            {
                var navigationModel = new GuidelinePageNavigationModel(parameters);
                Block      = navigationModel.CurrentBlock;
                BlockTitle = Block.Title;
                GenerateBlockActivityViewModels();
                GuidelineRunner = navigationModel.CurrentGuidelineRunner;
            }
            else
            {
                GuidelineRunner.SetCurrentBlock(Block);
            }

            // Determine the appropriate content template for the block.
            IGuidelineUITemplateSelector templateSelector = new ReflectiveGuidelineUITemplateSelector();

            Template = templateSelector.SelectUIForBlock(Block);
            Template.BindingContext = this;

            // Determine if action block, and therefore whether can progress.
            if (Block is ActionBlock)
            {
                CanProgress = false;
            }

            // Generate the proceed button text.
            var hasLinks = Block.Links.Count > 0;

            ProceedButtonText = hasLinks ? "NEXT" : "FINISH";
            ProceedCommand    = hasLinks ? new DelegateCommand(Proceed).ObservesCanExecute(o => CanProgress) : new DelegateCommand(Finish).ObservesCanExecute(o => CanProgress);
            DetermineInstructionalText();
        }