private void InitializeImageSource()
 {
     _d3D11Image = new D3D11Image();
     _d3D11Image.IsFrontBufferAvailableChanged += OnIsFrontBufferAvailableChanged;
     CreateBackBuffer();
     Source = _d3D11Image;
 }
        private void UnitializeImageSource()
        {
            _d3D11Image.IsFrontBufferAvailableChanged -= OnIsFrontBufferAvailableChanged;
            Source = null;

            if (_d3D11Image != null)
            {
                _d3D11Image.Dispose();
                _d3D11Image = null;
            }
            if (_renderTarget != null)
            {
                _renderTarget.Dispose();
                _renderTarget = null;
            }
        }