You are certainly blocking the UI thread by repeatedly calling your refreshMap
method in a loop.
Consider updating the pushpin positions in a Tick
event handler of a DispatcherTimer.
Note also that it is not necessary to constantly remove and add pushpins to your objectLayer
. Once a pushpin has been added to a MapLayer, you may just change its MapLayer.Position
attached property.