void ClearImageSource() { if (_sisNative != null) { image.Source = null; _sisNative.Dispose(); _sisNative = null; _imageSource = null; } }
void MainPage_Unloaded(object sender, RoutedEventArgs e) { DiscardDeviceResources(); _bitmap.Dispose(); _d2dFactory.Dispose(); _dwFactory.Dispose(); image.Source = null; _sisNative.Dispose(); _sisNative = null; }
void CreateImageSource() { ClearImageSource(); _imageSource = new SurfaceImageSource(_bitmap.PixelWidth, _bitmap.PixelHeight, false); _sisNative = ComObject.QueryInterface <DXGI.ISurfaceImageSourceNative>(_imageSource); _sisNative.SetDevice(_dxgiDevice); UpdateImageSource(false); image.Source = _imageSource; }