//public SharpDX.Direct2D1.Bitmap1 CreateBitmapTarget() //{ // return d2dTarget.CreateNewBitmapTarget(); //} void DrawingSurfaceSIS_Unloaded(object sender, RoutedEventArgs e) { CompositionTarget.Rendering -= CompositionTarget_Rendering; _deviceManager.OnInitialize -= _sisTarget1.Initialize; _deviceManager.OnInitialize -= _sisTarget2.Initialize; _deviceManager.OnInitialize -= _effectRenderer.Initialize; _deviceManager.OnInitialize -= _magicRenderer.Initialize; _deviceManager.Dispose(); _deviceManager = null; _sisTarget1.OnRender -= _effectRenderer.Render; _sisTarget1.Dispose(); _sisTarget1 = null; _sisTarget2.OnRender -= _magicRenderer.Render; _sisTarget2.Dispose(); _sisTarget2 = null; _hasInitializedSurface = false; this.Unloaded -= DrawingSurfaceSIS_Unloaded; }
//public SharpDX.Direct2D1.Bitmap1 CreateBitmapTarget() //{ // return d2dTarget.CreateNewBitmapTarget(); //} //void DrawingSurfaceSIS_Unloaded(object sender, RoutedEventArgs e) //{ // Unload(); //} public void Unload() { //if (_effectRenderer != null && _sisTarget1!=null ) _sisTarget1.OnRender -= _effectRenderer.Render; if (_renderRendererAction != null) { _loadAssetUriRendererAction = null; } CompositionTarget.Rendering -= CompositionTarget_Rendering; //this.Unloaded -= DrawingSurfaceSIS_Unloaded; if (_deviceManager != null && _sisTarget1 != null) { _deviceManager.OnInitialize -= _sisTarget1.Initialize; } //if(_deviceManager!=null && _effectRenderer!=null) { _deviceManager.OnInitialize -= _effectRenderer.Initialize; } if (_initializeRendererAction != null) { _initializeRendererAction = null; } //_deviceManager.Dispose(); //_deviceManager = null; if (_unloadRendererAction != null) { //_effectRenderer.Unload(); //_effectRenderer = null; _unloadRendererAction(); _unloadRendererAction = null; } if (_sisTarget1 != null) { _sisTarget1.Dispose(); _sisTarget1 = null; } _hasInitializedSurface = false; _deviceManager = null; d2dRectangleBottom.Fill = null; if (_ibTarget1 != null) { _ibTarget1.ImageSource = null; _ibTarget1 = null; } _initializeUIRendererAction = null; _loadAssetUriRendererAction = null; _unloadRendererAction = null; }