# Asynchronous methods?

**URL:** <https://community.thinkgeo.com/t/asynchronous-methods/2969>\
**Category:** WPF\
**Created:** [March 23, 2011, 7:15am UTC](https://community.thinkgeo.com/t/asynchronous-methods/2969 "2011-03-23T07:15:06Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![David6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/22d042/32.png) [@David6](https://community.thinkgeo.com/u/David6)\
**Post date:** [March 23, 2011, 7:15am UTC](https://community.thinkgeo.com/t/asynchronous-methods/2969/1 "2011-03-23T07:15:06Z")

</div>

I'm&nbsp;looking&nbsp;for&nbsp;some&nbsp;advice&nbsp;on&nbsp;running&nbsp;certain&nbsp;methods&nbsp;on&nbsp;the&nbsp;WPF&nbsp;control&nbsp;asynchronously.

Our&nbsp;project&nbsp;updates&nbsp;the&nbsp;map&nbsp;frequently&nbsp;calling:

Refresh(Overlay)

The&nbsp;problem&nbsp;with&nbsp;doing&nbsp;this&nbsp;so&nbsp;often&nbsp;is&nbsp;that&nbsp;it&nbsp;locks&nbsp;up&nbsp;the&nbsp;rest&nbsp;of&nbsp;the&nbsp;application.&nbsp;We've&nbsp;tried&nbsp;as&nbsp;much&nbsp;as&nbsp;possible&nbsp;to&nbsp;run&nbsp;queries&nbsp;etc&nbsp;in&nbsp;a&nbsp;background&nbsp;worker,&nbsp;its&nbsp;just&nbsp;the&nbsp;map&nbsp;redrawing&nbsp;itself&nbsp;that&nbsp;takes&nbsp;the&nbsp;time.

My&nbsp;question&nbsp;is,&nbsp;is&nbsp;there&nbsp;any&nbsp;way&nbsp;we&nbsp;can&nbsp;call&nbsp;the&nbsp;Refresh&nbsp;method&nbsp;asynchronously&nbsp;in&nbsp;order&nbsp;to&nbsp;properly&nbsp;maintain&nbsp;a&nbsp;responsive&nbsp;UI&nbsp;for&nbsp;the&nbsp;user?

---

<div class="post-metadata">

**Author:** ![Klaus3](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/e5b9ba/32.png) [@Klaus3](https://community.thinkgeo.com/u/Klaus3)\
**Post date:** [March 23, 2011, 11:06am UTC](https://community.thinkgeo.com/t/asynchronous-methods/2969/2 "2011-03-23T11:06:02Z")

</div>

David,&nbsp;I&nbsp;am&nbsp;sure&nbsp;you&nbsp;know&nbsp;that&nbsp;this&nbsp;is&nbsp;a&nbsp;WPF&nbsp;limitation&nbsp;and&nbsp;not&nbsp;necessary&nbsp;a&nbsp;MapSuite&nbsp;limitation.&nbsp;&nbsp;I&nbsp;doubt&nbsp;ThinkGeo&nbsp;can&nbsp;do&nbsp;anything&nbsp;about&nbsp;this.&nbsp;&nbsp;&nbsp;  
&nbsp;&nbsp;  
&nbsp;If&nbsp;calling&nbsp;Refresh(Overlay)&nbsp;using&nbsp;Dispatcher.BeginInvoke&nbsp;with&nbsp;DispatcherPriority&nbsp;set&nbsp;to&nbsp;Background&nbsp;or&nbsp;a&nbsp;level&nbsp;lower&nbsp;than&nbsp;Input&nbsp;does&nbsp;not&nbsp;work&nbsp;for&nbsp;you,&nbsp;then&nbsp;you&nbsp;may&nbsp;have&nbsp;to&nbsp;look&nbsp;into&nbsp;running&nbsp;the&nbsp;map&nbsp;on&nbsp;its&nbsp;own&nbsp;OI&nbsp;thread.&nbsp;&nbsp;I&nbsp;did&nbsp;contemplate&nbsp;this&nbsp;as&nbsp;our&nbsp;application&nbsp;also&nbsp;encounters&nbsp;heavy&nbsp;traffic,&nbsp;has&nbsp;to&nbsp;update&nbsp;data&nbsp;grids&nbsp;and&nbsp;refresh&nbsp;the&nbsp;map&nbsp;as&nbsp;well&nbsp;as&nbsp;respond&nbsp;to&nbsp;use&nbsp;input.&nbsp;&nbsp;In&nbsp;my&nbsp;case&nbsp;I&nbsp;used&nbsp;a&nbsp;combination&nbsp;of&nbsp;BeginInvokes,&nbsp;BackgroundWorkers&nbsp;and&nbsp;selective&nbsp;refreshing&nbsp;to&nbsp;avoid&nbsp;running&nbsp;map&nbsp;on&nbsp;its&nbsp;own&nbsp;OI&nbsp;thread.&nbsp;&nbsp;&nbsp;So&nbsp;far,&nbsp;so&nbsp;good&nbsp;but&nbsp;I&nbsp;am&nbsp;keeping&nbsp;an&nbsp;eye&nbsp;on&nbsp;things.&nbsp;&nbsp;In&nbsp;the&nbsp;mean&nbsp;time,&nbsp;we&nbsp;are&nbsp;re-architecting&nbsp;just&nbsp;in&nbsp;case&nbsp;map&nbsp;has&nbsp;to&nbsp;be&nbsp;run&nbsp;on&nbsp;its&nbsp;own&nbsp;OI&nbsp;thread.&nbsp;

---

<div class="post-metadata">

**Author:** ![David6](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/d/22d042/32.png) [@David6](https://community.thinkgeo.com/u/David6)\
**Post date:** [March 24, 2011, 5:05am UTC](https://community.thinkgeo.com/t/asynchronous-methods/2969/3 "2011-03-24T05:05:17Z")

</div>

Thanks&nbsp;for&nbsp;your&nbsp;answer&nbsp;Klaus,&nbsp;you've&nbsp;confirmed&nbsp;what&nbsp;I&nbsp;suspected.

We've&nbsp;already&nbsp;set&nbsp;about&nbsp;using&nbsp;a&nbsp;combination&nbsp;of&nbsp;BackgroundWorkers&nbsp;and&nbsp;Dispatcher.BeginInvoke&nbsp;to&nbsp;get&nbsp;things&nbsp;"appearing"&nbsp;faster.

I'm&nbsp;also&nbsp;in&nbsp;the&nbsp;process&nbsp;of&nbsp;making&nbsp;a&nbsp;large&nbsp;number&nbsp;of&nbsp;features&nbsp;(at&nbsp;a&nbsp;particular&nbsp;extent)&nbsp;appear&nbsp;as&nbsp;a&nbsp;region&nbsp;at&nbsp;a&nbsp;certain&nbsp;ZoomLevel.&nbsp;If&nbsp;anyone&nbsp;has&nbsp;any&nbsp;insight&nbsp;on&nbsp;this,&nbsp;please&nbsp;let&nbsp;me&nbsp;know.

---

<div class="post-metadata">

**Author:** ![Carlos1](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/c/6a8cbe/32.png) [@Carlos1](https://community.thinkgeo.com/u/Carlos1)\
**Post date:** [March 24, 2011, 5:48am UTC](https://community.thinkgeo.com/t/asynchronous-methods/2969/4 "2011-03-24T05:48:27Z")

</div>

Hi&nbsp;David,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Take&nbsp;a&nbsp;look&nbsp;into&nbsp;[wiki.thinkgeo.com/wiki/File:ServicesEditionSample\_ClusterPointStyle\_CS\_090918.zip](http://wiki.thinkgeo.com/wiki/File:ServicesEditionSample_ClusterPointStyle_CS_090918.zip),&nbsp;it&nbsp;might&nbsp;give&nbsp;you&nbsp;some&nbsp;ideas&nbsp;on&nbsp;how&nbsp;to&nbsp;aproach&nbsp;it.&nbsp;

---

<div class="post-metadata">

**Author:** ![Klaus3](https://community.thinkgeo.com/letter_avatar_proxy/v4/letter/k/e5b9ba/32.png) [@Klaus3](https://community.thinkgeo.com/u/Klaus3)\
**Post date:** [March 24, 2011, 9:27am UTC](https://community.thinkgeo.com/t/asynchronous-methods/2969/5 "2011-03-24T09:27:50Z")

</div>

David,&nbsp;also&nbsp;ensure&nbsp;you&nbsp;have&nbsp;the&nbsp;overlay&nbsp;hosting&nbsp;your&nbsp;feature&nbsp;layers&nbsp;set&nbsp;to&nbsp;MultipleTile.&nbsp;&nbsp;This&nbsp;way&nbsp;layer&nbsp;image&nbsp;is&nbsp;created&nbsp;asychronously.

---

<div class="post-metadata">

**Author:** ![ThinkGeo](https://community.thinkgeo.com/user_avatar/community.thinkgeo.com/thinkgeo/32/25029_2.png) [@ThinkGeo](https://community.thinkgeo.com/u/ThinkGeo)\
**Post date:** [March 28, 2011, 8:37pm UTC](https://community.thinkgeo.com/t/asynchronous-methods/2969/6 "2011-03-28T20:37:07Z")

</div>

Klaus&nbsp;&&nbsp;Carlos,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks&nbsp;for&nbsp;your&nbsp;posts,&nbsp;as&nbsp;so&nbsp;far,&nbsp;you&nbsp;are&nbsp;the&nbsp;expert&nbsp;of&nbsp;MapSuite&nbsp;products&nbsp;and&nbsp;will&nbsp;become&nbsp;to&nbsp;the&nbsp;MVPs.&nbsp;Dave,&nbsp;hope&nbsp;their&nbsp;posts&nbsp;can&nbsp;help&nbsp;you&nbsp;properly,&nbsp;if&nbsp;you&nbsp;still&nbsp;encounter&nbsp;any&nbsp;more&nbsp;questions&nbsp;please&nbsp;let&nbsp;us&nbsp;know,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Thanks,&nbsp;  
&nbsp;&nbsp;  
&nbsp;Scott,
