Skip to content

Instantly share code, notes, and snippets.

@limitedmage
Created March 17, 2011 03:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save limitedmage/873780 to your computer and use it in GitHub Desktop.
Save limitedmage/873780 to your computer and use it in GitHub Desktop.
private void CreateAd()
{
#if !DEBUG
AdControl.TestMode = false;
#endif
AdControl ad = new AdControl(
#if DEBUG
"test_client",
"Image480_80",
#else
"YOUR PUB CENTER APP ID HERE",
"YOUR PUB CENTER AD UNIT ID HERE",
#endif
AdModel.Contextual,
false
);
ad.Width = 480;
ad.Height = 80;
// AdContainer is some StackPanel in the page
AdContainer.Children.Add(ad);
this.Unloaded += (s, e) =>
{
if (AdContainer.Children.Contains(ad)) AdContainer.Children.Remove(ad);
ad = null;
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment