Good way to check for Views.ActiveView.Redraw() completion?

I’m working on a c# plugin that batch captures selected named views & display modes. Pseudo code:

void CaptureViews() {
  foreach (namedView in selectedNamedViews) {
    activeView = namedView
    foreach (displayMode in selectedDisplayModes) {
      activeView.DisplayMode = displayMode
      bitmap = activeView.CaptureToBitmap

For some of the heavier display modes (e.g. Arctic), the captured file didn’t match the display mode, so I made CaptureViews() async and added await Task.Delay(TimeSpan.FromSeconds(1)); after the Redraw(). This is working, but it doesn’t seem like a great solution. Is there a proper way to check whether Redraw() has completed?

Does this work:

bitmap = activeView.CaptureToBitmap;

– Dale

1 Like

Thanks Dale, I’m having a teammate test it now.


@dale that did the trick :man_facepalming: