public MainPage()
{
InitializeComponent();
tamekranreklam();
}
public void tamekranreklam()
{
interstitialAd = new InterstitialAd("ca-app-pub-955142777*****/******1813");
AdRequest adRequest = new AdRequest();
interstitialAd.ReceivedAd += OnAdReceived;
interstitialAd.ReceivedAd += interstitialAd_ReceivedAd;
interstitialAd.FailedToReceiveAd += interstitialAd_FailedToReceiveAd;
interstitialAd.DismissingOverlay += interstitialAd_DismissingOverlay;
interstitialAd.LoadAd(adRequest);
}
void interstitialAd_DismissingOverlay(object sender, AdEventArgs e)
{
Debug.WriteLine("Dismissing interstitial.");
}
void interstitialAd_FailedToReceiveAd(object sender, AdErrorEventArgs e)
{
Debug.WriteLine("Failed to receive interstitial with error " + e.ErrorCode);
}
void interstitialAd_ReceivedAd(object sender, AdEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Ad received successfully");
interstitialAd.ShowAd();
}
private void OnAdReceived(object sender, AdEventArgs e)
{
System.Diagnostics.Debug.WriteLine("Ad received successfully");
}
private void OnFailedToReceiveAd(object sender, AdErrorEventArgs errorCode)
{
Debug.WriteLine("Failed to receive ad with error " + errorCode.ErrorCode);
}
private void PanoramaItem_Loaded(object sender, RoutedEventArgs e)
{
AdView haberreklam = new AdView
{
Format = AdFormats.Banner,
AdUnitID = "ca-app-pub-******70579242/*****6619"
};
AdView sinemareklam = new AdView
{
Format = AdFormats.Banner,
AdUnitID = "ca-app-pub-*******70579242/*****9816"
};
haberreklam.ReceivedAd += OnAdReceived;
haberreklam.FailedToReceiveAd += OnFailedToReceiveAd;
//habergrd is gridname
habergrd.Children.Add(haberreklam);
haberreklam.Margin = new Thickness(0, 255, 0, 0);
haberreklam.VerticalAlignment = VerticalAlignment.Top;
AdRequest haberreklamreq = new AdRequest();
haberreklam.LoadAd(haberreklamreq);
sinemareklam.ReceivedAd += OnAdReceived;
sinemareklam.FailedToReceiveAd += OnFailedToReceiveAd;
//sinemagrd is gridname
sinemagr.Children.Add(sinemareklam);
sinemareklam.Margin = new Thickness(0, 260, -60, 0);
sinemareklam.VerticalAlignment = VerticalAlignment.Top;
AdRequest sinemareklamreq = new AdRequest();
sinemareklam.LoadAd(sinemareklamreq);
}