public D3DAppSwapChainBackgroundTarget(SwapChainBackgroundPanel panel)
        {
            this.backgroundPanel = panel;

            nativeBackgrounPanel = ToDispose(ComObject.As<SharpDX.DXGI.ISwapChainBackgroundPanelNative>(panel));
            this.backgroundPanel.SizeChanged += (sender, args) =>
            {
                SizeChanged();
            };
        }
Esempio n. 2
0
        public D3DAppSwapChainBackgroundTarget(SwapChainBackgroundPanel panel)
        {
            this.backgroundPanel = panel;

            nativeBackgrounPanel              = ToDispose(ComObject.As <SharpDX.DXGI.ISwapChainBackgroundPanelNative>(panel));
            this.backgroundPanel.SizeChanged += (sender, args) =>
            {
                SizeChanged();
            };
        }
        /// <summary>
        /// Initializes a new <see cref="SwapChainBackgroundPanelTarget"/> instance
        /// </summary>
        /// <param name="panel">The <see cref="SwapChainBackgroundPanel"/> to render to</param>
        public SwapChainBackgroundPanelTarget(SwapChainBackgroundPanel panel)
        {
            this.panel = panel;

            // Gets the native panel
            nativePanel = ComObject.As <ISwapChainBackgroundPanelNative>(panel);

            // Register event on Window Size Changed
            // So that resources dependent size can be resized
            Window.Current.CoreWindow.SizeChanged += CoreWindow_SizeChanged;
        }
        /// <summary>
        /// Initializes a new <see cref="SwapChainBackgroundPanelTarget"/> instance
        /// </summary>
        /// <param name="panel">The <see cref="SwapChainBackgroundPanel"/> to render to</param>
        public SwapChainBackgroundPanelTarget(SwapChainBackgroundPanel panel)
        {
            this.panel = panel;

            // Gets the native panel
            nativePanel = ComObject.As<ISwapChainBackgroundPanelNative>(panel);

            // Register event on Window Size Changed
            // So that resources dependent size can be resized
            Window.Current.CoreWindow.SizeChanged += CoreWindow_SizeChanged;
        }
        /// <summary>
        /// Binds the object to a SwapChainBackgroundPanel and initializes Direct3D11 resources.
        /// </summary>
        /// <param name="backgroundPanel">SwapChainBackgroundPanel control used for drawing.</param>
        public void BindToControl(SwapChainBackgroundPanel backgroundPanel)
        {
            this.ThrowIfDisposed();
            this.ThrowIfBound();

            this.backgroundPanel = backgroundPanel;
            this.nativeBackgroundPanel = ComObject.As<ISwapChainBackgroundPanelNative>(this.backgroundPanel);
            this.UpdateBackBufferSize();

            this.CreateDeviceDependentResources();
            this.CreateSizeDependentResources();

            CompositionTarget.Rendering += CompositionTarget_Rendering;
            this.backgroundPanel.SizeChanged += HostControl_SizeChanged;
            DisplayInformation.GetForCurrentView().DpiChanged += DisplayInformation_DpiChanged;
            
            this.IsBound = true;
        }