ArcGIS Desktop API - check if rendering has finished
Asked Answered
F

1

10

I've recently inherited a large project in C#, which uses ArcGIS to render some area plans. People currently using it kept complaining about an extremely poor performance of the tool and it's my task now to make it faster.

When I first looked at the code, I was terrified. It was full of 30-60s sleeps System.Threading.Sleep(30000); after every call to gis api causing simple actions to take minutes.

After a bit of testing, it became clear that removing them caused sketches to be incompelte or full of artifacts, simply because the scene hasn't been fully rendered before performing next actions.

My question is simple. Is there a way to get the current status of ArcGIS rendered, so instead of waiting for the 'default' 30s, I can stop the tool only until ArcGis flags the current view as ready?

Thank you

Edit: Sample Code

doc.ActiveView = (IActiveView)doc.PageLayout;
doc.ActiveView.ContentsChanged();
System.Threading.Thread.Sleep(5000);
doc.PageLayout.ZoomToWhole();    
System.Threading.Thread.Sleep(30000);

I can provide more code fragments, but I think the question is more generic, and not directly my-code related.

Flay answered 22/2, 2013 at 13:34 Comment(0)
M
1

I've had a quick look around the documentation and found the following:

  1. IPageLayoutControlEvents
  2. IActiveViewEvents

It looks like they be useful, particularly the "AfterDraw" events. I'd imagine you could listen to the relevant events to enable/disable your tool as needed.

Meaghan answered 18/6, 2013 at 13:17 Comment(1)
Seems like those handlers don't fire on the majority of the events in my application, so unfortunately this won't help much. I'll +1 for effort. Might have to leave it the way it is. Too much effort to rewrite the entire tool to handle those events.Flay

© 2022 - 2024 — McMap. All rights reserved.