public MainPage()
{
InitializeComponent();
AdControl adcontrol = new AdControl()
{
ApplicationId = "test_client",
AdUnitId = "TextAd",
Width = 480,
Height = 80,
IsAutoRefreshEnabled = true,
IsAutoCollapseEnabled = true,
CountryOrRegion = CultureInfo.CurrentCulture.TwoLetterISOLanguageName
};
adcontrol.ErrorOccurred += AdControl_OnErrorOccurred;
adcontrol.AdRefreshed += AdControl_OnAdRefreshed;
adcontrol.IsEngagedChanged += adcontrol_IsEngagedChanged;
this.AdsStackPanel.Children.Add(adcontrol);
}