async private void adView_AdFailed(object sender, MASTAdView.AdFailedEventArgs e)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate()
     {
         adView.Visibility = Windows.UI.Xaml.Visibility.Collapsed;
     });
 }
 async private void adView_AdFailed(object sender, MASTAdView.AdFailedEventArgs e)
 {
     await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate()
     {
         adView.RemoveContent();
     });
 }
Esempio n. 3
0
        async private void adView_AdFailed(object sender, MASTAdView.AdFailedEventArgs e)
        {
            await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate()
            {
                // Remove any existing ad content (last rendered ad).
                adView.RemoveContent();

                // Load the image resource to display when the adView fails to load a new ad.
                BitmapImage imageSource = new BitmapImage();
                imageSource.UriSource   = new Uri("ms-appx:///Assets/ErrorImage.png", UriKind.Absolute);

                // Use the adView's own containers to render the image.
                adView.ImageControl.Source = imageSource;
                adView.ImageBorder.Child   = adView.ImageControl;

                // Add the border as a child to the ad.  This way when/if a new ad is rendered the adView will handle resetting everything properly.
                adView.Children.Add(adView.ImageBorder);
            });
        }