Пример #1
0
 private void AutoSuggestBox_QuerySubmitted(AutoSuggestBox sender, AutoSuggestBoxQuerySubmittedEventArgs args)
 {
     if (!string.IsNullOrEmpty(args.QueryText) && args.ChosenSuggestion == null)
     {
         MainNavigationViewModel.ShowSearchResults(args.QueryText);
     }
 }
        // Get the frame that this flipviewindicator is a child of, and then navigate to the
        // sample that the user selected
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            FeaturedFlipViewSample SelectedSample = BannerFlipView.SelectedItem as FeaturedFlipViewSample;
            Frame mainPivotFrame = MainNavigationViewModel.GetPivotFrame(this);

            mainPivotFrame.Navigate(typeof(SampleHost), SelectedSample.SampleDefinition);
        }
        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;
        }
Пример #4
0
        private void SamplePage_BackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            Frame pivotItemFrame = MainNavigationViewModel.GetPivotFrame(this);

            if (pivotItemFrame != null)
            {
                e.Handled = true;
                (pivotItemFrame).GoBack();
            }
        }
Пример #5
0
 private void AutoSuggestBox_SuggestionChosen(AutoSuggestBox sender, AutoSuggestBoxSuggestionChosenEventArgs args)
 {
     if (((SampleDefinition)(args.SelectedItem)) == _dummySampleDefinition)
     {
         SearchBox.Text = "";
     }
     else
     {
         MainNavigationViewModel.NavigateToSample((SampleDefinition)args.SelectedItem);
     }
 }
        public void TagHyperlink_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
        {
            var inline       = ((Hyperlink)sender).Inlines[0];
            var run          = (Run)inline;
            var searchString = run.Text;

            if (!String.IsNullOrEmpty(searchString))
            {
                MainNavigationViewModel.ShowSearchResults(searchString);
            }
        }
Пример #7
0
        public MainPage(Rect imageBounds)
        {
            _instance            = this;
            _runtimeCapabilities = new RuntimeSupportedSDKs();
            _currentFrame        = null;

            // Get hardware capabilities and register changed event listener only when targeting the
            // appropriate SDK version and the runtime supports this version
            if (_runtimeCapabilities.IsSdkVersionRuntimeSupported(RuntimeSupportedSDKs.SDKVERSION._15063))
            {
#if SDKVERSION_15063
                _capabilities          = CompositionCapabilities.GetForCurrentView();
                _capabilities.Changed += HandleCapabilitiesChangedAsync;
                _areEffectsSupported   = _capabilities.AreEffectsSupported();
                _areEffectsFast        = _capabilities.AreEffectsFast();
#endif
            }
            else
            {
                _areEffectsSupported = true;
                _areEffectsFast      = true;
            }
            this.InitializeComponent();
            _mainNavigation = new MainNavigationViewModel();

            // Initialize the image loader
            ImageLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

            // Show the custome splash screen
            ShowCustomSplashScreen(imageBounds);

            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = false;

#if SDKVERSION_16299
            // Apply acrylic styling to the navigation and caption
            if (_runtimeCapabilities.IsSdkVersionRuntimeSupported(RuntimeSupportedSDKs.SDKVERSION._16299))
            {
                // Extend the app into the titlebar so that we can apply acrylic
                CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
                ApplicationViewTitleBar titleBar = ApplicationView.GetForCurrentView().TitleBar;
                titleBar.ButtonBackgroundColor         = Colors.Transparent;
                titleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
                titleBar.ButtonForegroundColor         = Colors.Black;

                // Apply a customized control template to the pivot
                MainPivot.Template = (ControlTemplate)Application.Current.Resources["PivotControlTemplate"];

                // Apply acrylic to the main navigation
                TitleBarRow.Height      = new GridLength(31);
                TitleBarGrid.Background = (Brush)Application.Current.Resources["SystemControlChromeMediumLowAcrylicWindowMediumBrush"];
            }
#endif
        }
 private void FullSampleList_ItemClick(object sender, ItemClickEventArgs e)
 {
     MainNavigationViewModel.NavigateToSample(sender, e);
 }
Пример #9
0
 public static void FeaturedSampleList_ItemClick(object sender, ItemClickEventArgs e)
 {
     MainNavigationViewModel.NavigateToSample(sender, e);
 }
 private void SettingsButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e)
 {
     MainNavigationViewModel.ShowSettings();
 }
Пример #11
0
        // Navigate to the sample that the user selected
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            FeaturedFlipViewSample SelectedSample = BannerFlipView.SelectedItem as FeaturedFlipViewSample;

            MainNavigationViewModel.NavigateToSample(SelectedSample.SampleDefinition);
        }