Пример #1
0
        public Shell()
        {
            this.InitializeComponent();
            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);
            CoreApplication.GetCurrentView().TitleBar.ExtendViewIntoTitleBar = true;
            CoreWindowLogic logic = new CoreWindowLogic();

            ShellVM = DataContext as ShellViewModel;
        }
Пример #2
0
        public MainPage(Rect imageBounds)
        {
            this.InitializeComponent();

            // Initialize the surface loader
            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

            // Show the custome splash screen
            ShowCustomSplashScreen(imageBounds);
        }
        public DemoPage7()
        {
            this.InitializeComponent();

            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

            compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            StartExpressionAnimation();
        }
        public DemoPage6()
        {
            this.InitializeComponent();

            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

            rootVisual = ElementCompositionPreview.GetElementVisual(this);
            compositor = rootVisual.Compositor;

            AddInteractableImage();
        }
Пример #5
0
        protected override UIElement CreateShell(Frame rootFrame)
        {
            Dispatcher = Window.Current.Dispatcher;
            var compositor = ElementCompositionPreview.GetElementVisual(rootFrame).Compositor;

            SurfaceLoader.Initialize(compositor);
            Toolkit.Animations.SurfaceLoader.Initialize(compositor);

            _shell.CurrentFrame = rootFrame;
            return(_shell);
        }
Пример #6
0
        public DemoPage5()
        {
            this.InitializeComponent();

            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

            compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            StartExpressionAnimation();
            //ParallaxScrollingDemoListView.Loaded += ParallaxScrollingDemoListView_Loaded;
        }
        public DemoPage4()
        {
            this.InitializeComponent();

            // SurfaceLoader 是微軟幫我們寫好的元件
            // 可以透過它,以 Win2D 的方式讀圖
            // *** 用之前要 call Initialize(); 不用了要 call Uninitialize();
            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

            rootVisual = ElementCompositionPreview.GetElementVisual(this);
            compositor = rootVisual.Compositor;

            ReadImageBySurfaceLoader();
            //StartGraphicsEffect();
            //StartMultipleGraphicsEffect();
        }
Пример #8
0
        public CompositionImage()
        {
            this.DefaultStyleKey = typeof(CompositionImage);
            this.Background      = new SolidColorBrush(Colors.Transparent);
            this._stretchMode    = CompositionStretch.Uniform;
            this.Loading        += CompImage_Loading;
            this.Unloaded       += CompImage_Unloaded;
            this.SizeChanged    += CompImage_SizeChanged;

            _compositor = ElementCompositionPreview.GetElementVisual(this).Compositor;

            // Intialize the statics as needed
            if (!_staticsInitialized)
            {
                _defaultPlaceholderBrush = _compositor.CreateColorBrush(Colors.DarkGray);

                TimeSpan duration = TimeSpan.FromMilliseconds(1000);
                _fadeOutAnimation = _compositor.CreateScalarKeyFrameAnimation();
                _fadeOutAnimation.InsertKeyFrame(0, 1);
                _fadeOutAnimation.InsertKeyFrame(1, 0);
                _fadeOutAnimation.Duration = duration;

                _scaleAnimation = _compositor.CreateVector2KeyFrameAnimation();
                _scaleAnimation.InsertKeyFrame(0, new Vector2(1.25f, 1.25f));
                _scaleAnimation.InsertKeyFrame(1, new Vector2(1, 1));
                _scaleAnimation.Duration = duration;

                _staticsInitialized = true;
            }

            // Initialize the surface loader if needed
            if (!SurfaceLoader.IsInitialized)
            {
                SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);
            }

            _placeholderDelay = TimeSpan.FromMilliseconds(50);
            _surfaceBrush     = _compositor.CreateSurfaceBrush(null);
        }
Пример #9
0
        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
            this.InitializeComponent();

            // Initialize the surface loader
            SurfaceLoader.Initialize(ElementCompositionPreview.GetElementVisual(this).Compositor);

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