Beispiel #1
0
        /// <summary>
        /// Called when one of the dependency properties has changed.
        /// </summary>
        protected override async void OnPropertyChanged(DependencyPropertyChangedEventArgs e)
        {
            base.OnPropertyChanged(e);

            if (!GraphicsCore.IsInitialized)
            {
                return;
            }
            if (this.IsInDesignMode())
            {
                return;
            }

            if (e.Property == SeeingSharpRendererElement.SceneProperty)
            {
                m_renderLoop.SetScene(this.Scene);
                SceneChanged.Raise(this, EventArgs.Empty);
            }
            else if (e.Property == SeeingSharpRendererElement.CameraProperty)
            {
                m_renderLoop.Camera = this.Camera;
                CameraChanged.Raise(this, EventArgs.Empty);
            }
            else if (e.Property == SeeingSharpRendererElement.DrawingLayer2DProperty)
            {
                if (e.OldValue != null)
                {
                    await m_renderLoop.Deregister2DDrawingLayerAsync(e.OldValue as Custom2DDrawingLayer);
                }
                if (e.NewValue != null)
                {
                    await m_renderLoop.Register2DDrawingLayerAsync(e.NewValue as Custom2DDrawingLayer);
                }
                DrawingLayer2DChanged.Raise(this, EventArgs.Empty);
            }
        }