public MonoGameNavigationService(
     IServiceLocator serviceLocator,
     INavigationLookup navigationLookup,
     IThreadService threadService,
     IScreenGame screenGame)
 {
     _serviceLocator   = serviceLocator;
     _navigationLookup = navigationLookup;
     _threadService    = threadService;
     _screenGame       = screenGame;
 }
 public FormsNavigationService(
     IServiceLocator serviceLocator,
     INavigationLookup navigationLookup,
     IFormsApplicationProxy application,
     IThreadService threadService)
 {
     _serviceLocator   = serviceLocator;
     _navigationLookup = navigationLookup;
     _application      = application;
     _threadService    = threadService;
 }
        protected BaseTabbedPage(
            TViewModel viewModel,
            INavigationService navigationService,
            INavigationLookup navigationLookup,
            IServiceLocator serviceLocator,
            IAnalyticsService analyticsService)
        {
            ViewModel      = viewModel;
            BindingContext = ViewModel;

            On <Android>().SetToolbarPlacement(ToolbarPlacement.Bottom);

            if (viewModel is ITabbedViewModel _)
            {
                SetBinding(TabDefinitionsProperty, new Binding(nameof(ITabbedViewModel.TabDefinitions), BindingMode.OneWay,
                                                               new ActionConverter <IReadOnlyList <TabDefinition> >(async tabs =>
                {
                    if (tabs == null)
                    {
                        return;
                    }

                    foreach (var tabDefinition in tabs)
                    {
                        if (TabExists(tabDefinition))
                        {
                            analyticsService.Debug("Tab already exists");
                            return;
                        }

                        var viewType = navigationLookup.GetViewType(tabDefinition.ViewModelType);
                        if (viewType == null)
                        {
                            throw new NavigationException($"No view is registered for {tabDefinition.ViewModelType.Name}");
                        }

                        var view = serviceLocator.Resolve(viewType);
                        if (view == null)
                        {
                            throw new NavigationException($"No View of type {viewType.Name} has been registered with the Ioc container");
                        }

                        if (!(view is Page page))
                        {
                            throw new NavigationException($"View type {viewType.Name} is not a {nameof(Page)}");
                        }

                        switch (page.BindingContext)
                        {
                        case IAsyncInitializable initializable:
                            await initializable.InitializeAsync();
                            break;

                        case IInitializingViewModel initializableViewModel:
                            initializableViewModel.InitializeCommand.Execute();
                            break;
                        }

                        if (tabDefinition.NavigationStackName != null)
                        {
                            analyticsService.Debug($"Added new navigating tab for {tabDefinition.ViewModelType.Name}");
                            Children.Add(new NavigationView(navigationService, page, tabDefinition.NavigationStackName)
                            {
                                Title = tabDefinition.Title
                            });
                        }
                        else
                        {
                            analyticsService.Debug($"Added new tab for {tabDefinition.ViewModelType.Name}");
                            page.Title = tabDefinition.Title;
                            Children.Add(page);
                        }
                    }
                })));
            }
        }