Пример #1
0
        private static async Task Render()
        {
            RenderStopWatch.Restart();

            if (_workerWindow == IntPtr.Zero && !DesktopHandler.TryGetWorkerWindow(out _workerWindow))
            {
                return;
            }

            if (!DesktopHandler.TryGetDeviceContext(_workerWindow, out var deviceContext))
            {
                return;
            }

            using (var bufferedGraphics = _bufferedGraphicsContext.Allocate(deviceContext, _area))
            {
                await _widgetService.Render(bufferedGraphics.Graphics);

                bufferedGraphics.Render(deviceContext);
                _bufferedGraphicsContext.Invalidate();
            }

            Native.ReleaseDC(_workerWindow, deviceContext);
            Debug.WriteLine($"Render() took: {RenderStopWatch.ElapsedMilliseconds}ms");
        }