Why are the settings and settings URL static members?

Dec 26, 2012 at 11:25 PM

Why are the _settings and _settingsURL members static on AdRotatorControl? This means every instance of AdRotatorControl in my app will have the same settings and settingsURL as the first one that loads. Because of this, I can only use one PubCenter ad unit in my Win8 app if I'm going to use AdRotatorControl with all my ads. In my app I have four different ad units using two different sizes, but the way the AdRotatorControl works, I will have to choose which one to use. A better way might be to make a dictionary and cache each settings object with each URL and make the dictionary static.


Dec 27, 2012 at 3:46 PM

Ok, at present we only support one configuration per ad provider. This is a limitation of the V1 framework and we are looking to remove that impediment in V2 along with a host of other features.

The properties are static because that's how XAML declares dependency properties, if you are trying to have two instances of AdRotator running on the same page it should still work (but currently untested)

I'll do some investigation to see how we can support multiple instances on the same page.

If you are using multiple pubcenter APPID's or pub id's then we currently recommend to host your configuration XML on a free hosting service like Azure websites or AppHarbour and swap out ID's in the file remotely.  not an ideal solution but until V2 it's the only workable way at present. 

Dec 27, 2012 at 5:37 PM

Right, eventually got to the bottom of that issue (and also got which property you were referring to)

In the Win 8 version we can do without the local property as there are no cross thread issues, however in WP it causes issues.  So just removed the static reference to that property now so you can have multiple controls on the same page, tested and it's working fine.

Dec 27, 2012 at 6:09 PM

Great, thanks for the quick work!

Jan 22, 2013 at 10:51 PM

Are there any news on this?

I have the problem, that I have two different ads with different sizes - and some times one size is wrong.
I think this is related to the static probs... 

Jan 23, 2013 at 10:11 AM

The NuGet package was updated on the 27th December to allow different remote URL's to be used on separate ad controls and was tested without issue which is what this thread was referring to.

If you have Ads of different sizes then you shouldn't use the same AdControl as it doesn't support that at present, all ads in a specific area on the screen should use the same size.

If you have a requirement to support different AdSizes in the same AdChain on the same control then we could potentially look to supporting that in V2

Jan 23, 2013 at 11:07 AM

Thanks for our quick response.

To clarify:

I use two different AdControls - each with one fixed sized - these two sizes are different.
Is this already supported? Then I have the problem described above.

Jan 23, 2013 at 2:47 PM

That should work, I tested with two different configurations with two controls on the same page with the latest update without issue.  Didn't try with different sizes but cannot see off the top of my head why that would be a problem.

All I can say is, install the latest NuGet package and try it, let us know if you run into any issues.