Esempio n. 1
0
 private void ThisUnloaded(object sender, RoutedEventArgs e)
 {
     DisplayInformation.DisplayContentsInvalidated -= DisplayInformation_DisplayContentsInvalidated;
     _canvas?.RemoveFromVisualTree();
     _canvas = null;
     // dispose buffers
     _buffer.Dispose();
     _tmpBuffer.Dispose();
     _background.Dispose();
     foreach (var buffer in _undoBuffer)
     {
         buffer.Value.Dispose();
     }
     foreach (var buffer in _redoBuffer)
     {
         buffer.Value.Dispose();
     }
     foreach (var layer in _layers)
     {
         layer.Image.Dispose();
     }
     _undoBuffer.Clear();
     _redoBuffer.Clear();
     _layers.Clear();
     _buffer     = null;
     _tmpBuffer  = null;
     _background = null;
 }
Esempio n. 2
0
 protected override void OnApplyTemplate()
 {
     _canvas              = (CanvasSwapChainPanel)GetTemplateChild("PART_canvas");
     _canvas.Loaded      += CanvasCreateResources;
     _canvas.SizeChanged += CanvasSizeChanged;
     _scrollViewer        = (ScrollViewer)GetTemplateChild("PART_ScrollViewer");
     _horizontalBar       = _scrollViewer.GetVisualChildren <ScrollBar>()
                            .FirstOrDefault(x => x.Orientation == Orientation.Horizontal);
     _verticalBar = _scrollViewer.GetVisualChildren <ScrollBar>()
                    .FirstOrDefault(x => x.Orientation == Orientation.Vertical);
 }
Esempio n. 3
0
 public static CanvasRenderTarget CreateEmpty(CanvasSwapChainPanel device, Size size, float dpi)
 {
     return(CreateEmpty(device.SwapChain, size, dpi));
 }