Inject View into Region on Background Thread

Nov 26, 2008 at 10:12 PM
how would we go about injecting a view into a region on a background thread. 


Example:

 

private void ActivateView(string viewId)

 

{

//stuff gets done here to reactivate an existing view

 

 

IRegion mainRegion = _regionManager.Regions[RegionNames.MainRegion];

 

 

CleanUp.CheckViews(mainRegion);

 

 

ApplicationView view = _container.Resolve<ApplicationView>();

 

 

if (view != null)

 

{

 

if (mainRegion.ActiveViews.Contains(view))

 

mainRegion.Activate(view);

 

else

 

mainRegion.Add(view,

"ApplicationView");

 

}}

Is there a good way to write an extension to launch this on a background thread?  Should we extend IRegion Add Method?  Could someone provide an example?

Thanks