async Task CaptureThumbnail(UserControl exampleControl, ExampleDefinition exampleDefinition) { CanvasControl canvasControl; ICanvasAnimatedControl animatedControl; MethodInfo drawMethod; // If there are any ProgressRing indicators in the UI, wait for them to finish whatever they are doing. await WaitForProgressRings(exampleControl); var customThumbnailSource = exampleControl as ICustomThumbnailSource; var customThumbnail = (customThumbnailSource != null) ? customThumbnailSource.Thumbnail : null; if (customThumbnail != null) { // This example explicitly tells us what thumbnail to use. await CaptureThumbnailFromCustomSource(customThumbnail); } else if (FindControlAndDrawMethod <CanvasControl, CanvasDrawEventArgs>(exampleControl, out canvasControl, out drawMethod)) { // It's a CanvasControl! await CaptureThumbnailFromCanvasControl(canvasControl, drawMethod); } else if (FindControlAndDrawMethod <ICanvasAnimatedControl, CanvasAnimatedDrawEventArgs>(exampleControl, out animatedControl, out drawMethod)) { // It's a CanvasAnimatedControl! await CaptureThumbnailFromAnimatedControl(animatedControl, drawMethod); } else { // This example does not use either of the Win2D controls, but we can still capture it via a XAML RenderTargetBitmap. await CaptureThumbnailFromXaml(); } }
async Task CaptureThumbnail(UserControl exampleControl, ExampleDefinition exampleDefinition) { CanvasControl canvasControl; ICanvasAnimatedControl animatedControl; MethodInfo drawMethod; if (FindControlAndDrawMethod <CanvasControl, CanvasDrawEventArgs>(exampleControl, out canvasControl, out drawMethod)) { // It's a CanvasControl! await CaptureThumbnailFromCanvasControl(canvasControl, drawMethod); } else if (FindControlAndDrawMethod <ICanvasAnimatedControl, CanvasAnimatedDrawEventArgs>(exampleControl, out animatedControl, out drawMethod)) { // It's a CanvasAnimatedControl! await CaptureThumbnailFromAnimatedControl(animatedControl, drawMethod); } else { // This example does not use either of the Win2D controls, but we can still capture it via a XAML RenderTargetBitmap. await CaptureThumbnailFromXaml(); } }
public Generator(ExampleDefinition exampleDefinition, StorageFolder outputFolder) { this.exampleDefinition = exampleDefinition; this.outputFolder = outputFolder; }
public Generator(ExampleDefinition exampleDefinition, StorageFolder outputFolder, CoreDispatcher uiThreadDispatcher) { this.exampleDefinition = exampleDefinition; this.outputFolder = outputFolder; this.uiThreadDispatcher = uiThreadDispatcher; }