_gt.SuspendUpdate = False System.Threading.Thread.Sleep(300) _gt.SuspendUpdate = True
Solved! Go to Solution.
public boolean isSuspendUpdate() throws IOException, AutomationException
Disables automatic refreshing of the display until unsuspended or until the display is explicitly refreshed. Suspending automatic refresh is ideal before bulk updates.
Description
Suspends update (i.e refresh) of the display. This property is false by default. This means the GraphicTracker will automatically refresh the display after each graphic is changed.
Setting this property to true, moving the graphics and then setting this property to false will result in one refresh call and will draw all graphics at once. In an dynamic map, this property is not relevant.
I am developing an application using the GraphicTracker to display moving icons. I am using the Windows.Forms.Timer event to suspend the display updates for two seconds. I have another couple subroutines that creates and removes GraphicTrackerSymbols to the tracker. All this happens on the same thread as the Windows.Forms.Timer does excute on the main gui thread. I have also verified this in debug.
Every so often the program will crash with an AccessViolationException while trying to set the GraphicTracker.SuspendUpdate property to FALSE; it ALWAYS fails on trying to set that property to "FALSE". What I noticed was that if I do not remove any items from the GraphicTracker it does not fail. When I am removing items here and there as needed at some point it will fail. It may be 30 seconds or 2 minutes. I use the exact same test data (geometry/symbols/coordinates) but it still fails at some "random" time. The map no longer updates on the screen and the whole map is unusable. I cannot seem to recover or continue on. Catching the exception makes no difference as the map just will not work anymore.
Here is the timer code. The timer itself is set to run every 2 seconds._gt.SuspendUpdate = False System.Threading.Thread.Sleep(300) _gt.SuspendUpdate = True
My thoughts are that there is some timing issue while using the "Remove" method on the GraphicTracker object that conflicts with the "SuspendUpdate" property. I have tried setting the timer to be a longer or shorter interval and also changing the "Sleep" interval but nothing seems to help.
_gt.SuspendUpdate = False System.Threading.Thread.Sleep(300) _gt.SuspendUpdate = True