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.