public MainPage(Rect imageBounds)
        {
            _instance = this;

            // Get hardware capabilities and register changed event listener
#if SDKVERSION_INSIDER
            _capabilities          = CompositionCapabilities.GetForCurrentView();
            _capabilities.Changed += HandleCapabilitiesChangedAsync;
            _areEffectsSupported   = _capabilities.AreEffectsSupported();
            _areEffectsFast        = _capabilities.AreEffectsFast();
#else
            _areEffectsSupported = true;
            _areEffectsFast      = true;
#endif
            _runtimeCapabilities = new RuntimeSupportedSDKs();
            this.InitializeComponent();

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

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

            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
        }
Esempio n. 2
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
        }