public MainNavigationViewModel(ISampleGalleryUIHost hostingUI)
        {
            _hostingUI = hostingUI;

            _hostingUI.BackStackStateChanged += (object sender, EventArgs args) =>
            {
                // Show or hide the global back button
                SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                    _hostingUI.CanGoBack ?
                    AppViewBackButtonVisibility.Visible :
                    AppViewBackButtonVisibility.Collapsed;
            };

            SystemNavigationManager.GetForCurrentView().BackRequested += (object backSender, BackRequestedEventArgs backArgs) =>
            {
                _hostingUI.GoBack();
            };



            // Build a collection used to populate the navigation menu. This is where you can define the display names of
            // each menu item and which page they map to.
            _mainMenuList = new List <NavigationItem>();
            AddNavigationItem(_mainMenuList, "Home", SampleCategory.None, typeof(HomePage), addEvenIfNoMatchingSamples: true, thumbnail: "ms-appx:///Assets/CategoryIcons/table_home_icon.png");
            AddNavigationItem(_mainMenuList, "Light", SampleCategory.Light, typeof(BaseCategoryPage), categoryDescription: CategoryDescription_Light, thumbnail: "ms-appx:///Assets/CategoryIcons/table_light_icon_bw.png");
            AddNavigationItem(_mainMenuList, "Depth", SampleCategory.Depth, typeof(BaseCategoryPage), categoryDescription: CategoryDescription_Depth, thumbnail: "ms-appx:///Assets/CategoryIcons/table_depth_icon_bw.png");
            AddNavigationItem(_mainMenuList, "Motion", SampleCategory.Motion, typeof(BaseCategoryPage), categoryDescription: CategoryDescription_Motion, thumbnail: "ms-appx:///Assets/CategoryIcons/table_motion_icon_bw.png");
            AddNavigationItem(_mainMenuList, "Material", SampleCategory.Material, typeof(BaseCategoryPage), categoryDescription: CategoryDescription_Material, thumbnail: "ms-appx:///Assets/CategoryIcons/table_material_icon_bw.png");
            AddNavigationItem(_mainMenuList, "Scale", SampleCategory.Scale, typeof(BaseCategoryPage), categoryDescription: CategoryDescription_Scale, thumbnail: "ms-appx:///Assets/CategoryIcons/table_scale_icon_bw.png");
            AddNavigationItem(_mainMenuList, "API Reference", SampleCategory.APIReference, typeof(BaseCategoryPage), categoryDescription: CategoryDescription_APIReference, thumbnail: "ms-appx:///Assets/CategoryIcons/table_reference_icon.png");

            s_instance = this;
        }
Пример #2
0
 public void GoBack()
 {
     _actualContent.GoBack();
 }