private void DeviceLost(CanvasDevice sender, object args) { sender.DeviceLost -= DeviceLost; _canvasDevice = new CanvasDevice(); _canvasDevice.DeviceLost += DeviceLost; _deviceLostHelper.WatchDevice(_canvasDevice); CanvasComposition.SetCanvasDevice(_graphicsDevice, _canvasDevice); }
public ImageLoader(Compositor compositor) { Debug.Assert(compositor != null && _compositor == null); _compositor = compositor; _drawingLock = new object(); _deviceLostHelper = new DeviceLostHelper(); _canvasDevice = new CanvasDevice(); _canvasDevice.DeviceLost += DeviceLost; _deviceLostHelper.WatchDevice(_canvasDevice); _deviceLostHelper.DeviceLost += DeviceRemoved; _graphicsDevice = CanvasComposition.CreateCompositionGraphicsDevice(_compositor, _canvasDevice); _graphicsDevice.RenderingDeviceReplaced += RenderingDeviceReplaced; }