/// <summary>
        /// Detaches the renderer from the current target panel.
        /// </summary>
        public void Detach()
        {
            try
            {
                if (m_targetPanel == null)
                {
                    return;
                }

                // Clear view resources
                m_renderLoop.UnloadViewResources();
                m_renderLoop.DeregisterRenderLoop();

                // Clear event registrations
                m_targetPanel.SizeChanged             -= OnTargetPanel_SizeChanged;
                m_targetPanel.Loaded                  -= OnTargetPanel_Loaded;
                m_targetPanel.Unloaded                -= OnTargetPanel_Unloaded;
                m_targetPanel.CompositionScaleChanged -= OnTargetPanel_CompositionScaleChanged;

                //Clear created references
                m_observerSizeChanged.Dispose();
                m_observerSizeChanged = null;
                m_targetPanel.Dispose();
                m_targetPanel = null;
            }
            catch (Exception ex)
            {
                CommonTools.RaiseUnhandledException(
                    this.GetType(), this, ex,
                    "Detaching the FrozenSyBackgroundPanelPainter");
            }
        }
示例#2
0
        /// <summary>
        /// Called when the image is unloaded.
        /// </summary>
        /// <param name="sender">The sender.</param>
        /// <param name="e">The <see cref="System.Windows.RoutedEventArgs"/> instance containing the event data.</param>
        private void OnUnloaded(object sender, RoutedEventArgs e)
        {
            if (!GraphicsCore.IsInitialized)
            {
                return;
            }
            if (this.IsInDesignMode())
            {
                return;
            }

            m_renderLoop.DeregisterRenderLoop();
        }
        public void Detach()
        {
            try
            {
                if (m_targetPanel == null)
                {
                    return;
                }

                //// Deregister simple mouse movement
                //UnloadMouseMovement();

                // Clear view resources
                m_renderLoop.UnloadViewResources();
                m_renderLoop.DeregisterRenderLoop();

                // Reset interop settings
                m_targetPanel.SetContentProvider(null);
                m_targetPanel.SetManipulationHandler(null);
                m_drawingInterop = null;

                // Clear event registrations
                m_targetPanel.SizeChanged -= OnTargetPanelSizeChanged;
                m_targetPanel.Loaded      -= OnTargetPanelLoaded;
                m_targetPanel.Unloaded    -= OnTargetPanelUnloaded;

                //Clear created references
                m_observerSizeChanged.Dispose();
                m_observerSizeChanged = null;
                m_targetPanel         = null;
            }
            catch (Exception ex)
            {
                CommonTools.RaiseUnhandledException(
                    this.GetType(), this, ex,
                    "Detaching the FrozenSyBackgroundPanelPainter");
            }
        }
        /// <summary>
        /// Stops rendering to the target CoreWindow.
        /// </summary>
        public void Dispose()
        {
            if (m_isDisposed)
            {
                return;
            }
            m_isDisposed = true;

            m_targetWindow.SizeChanged -= OnTargetWindow_SizeChanged;

            m_displayInfo.DpiChanged         -= OnDisplayInfo_DpiChanged;
            m_displayInfo.OrientationChanged -= OnDisplayInfo_OrientationChanged;

            // Clear view resources
            m_renderLoop.UnloadViewResources();
            m_renderLoop.DeregisterRenderLoop();
        }
示例#5
0
        /// <summary>
        /// Stops rendering.
        /// </summary>
        private void StopRendering()
        {
            if (this.DesignMode)
            {
                return;
            }
            if (!SeeingSharpApplication.IsInitialized)
            {
                return;
            }
            if (!GraphicsCore.IsInitialized)
            {
                return;
            }

            if (m_renderLoop.IsRegisteredOnMainLoop)
            {
                m_renderLoop.DiscardRendering = true;
                m_renderLoop.DeregisterRenderLoop();
            }
        }