async private void adView_AdFailed(object sender, MASTAdView.AdFailedEventArgs e) { await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate() { adView.RemoveContent(); }); }
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_LoggingEvent(object sender, MASTAdView.LoggingEventEventArgs e) { // Since these events can come from a non-main/UI thread, dispatch properly. await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate() { textBlock.Text += "LogLevel:" + e.LogLevel + " Entry:" + e.Entry + "\n\n"; }); }
async private void adView_ProcessedRichmediaRequest(object sender, MASTAdView.ProcessedRichmediaRequestEventArgs e) { // Since these events can come from a non-main/UI thread, dispatch properly. await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate() { textBlock.Text += "URI:" + e.URI + " Handled:" + e.Handled + "\n\n"; }); }
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); }); }
private void PhoneApplicationPage_Loaded(object sender, RoutedEventArgs e) { object obj = null; if (PhoneApplicationService.Current.State.TryGetValue("configureAdView", out obj) == true) PhoneApplicationService.Current.State.Remove("configureAdView"); if (obj == null) return; adView = (MASTAdView)obj; UseInternalBrowserCheckBox.IsChecked = adView.UseInteralBrowser; UseLocationDetectionCheckBox.IsChecked = adView.LocationDetectionEnabled; xTextBox.Text = adView.Margin.Left.ToString(); yTextBox.Text = adView.Margin.Right.ToString(); if (adView.HorizontalAlignment != System.Windows.HorizontalAlignment.Stretch) widthTextBox.Text = adView.Width.ToString(); heightTextBox.Text = adView.Height.ToString(); string value = null; if (adView.AdRequestParameters.TryGetValue("size_x", out value) == true) maxWidthTextBox.Text = value; if (adView.AdRequestParameters.TryGetValue("size_y", out value) == true) maxHeightTextBox.Text = value; if (adView.AdRequestParameters.TryGetValue("min_size_x", out value) == true) minWidthTextBox.Text = value; if (adView.AdRequestParameters.TryGetValue("min_size_y", out value) == true) minHeightTextBox.Text = value; }
private void adView_SavingPhoto(object sender, MASTAdView.SavingPhotoEventArgs e) { string entry = "adView_SavingPhoto Photo:" + e.URL; addEntry(entry); }
private void adView_ReceivedThirdPartyRequest(object sender, MASTAdView.ThirdPartyRequestEventArgs e) { string entry = "adView_ReceivedThirdPartyRequest Properties:" + App.FormattedString(e.Properties) + " Parameters:" + App.FormattedString(e.Parameters); addEntry(entry); }
private void adView_ProcessedRichmediaRequest(object sender, MASTAdView.ProcessedRichmediaRequestEventArgs e) { string entry = "adView_ProcessedRichmediaRequest URI:" + e.URI + " Handled:" + e.Handled; addEntry(entry); }
private void adView_PlayingVideo(object sender, MASTAdView.PlayingVideoEventArgs e) { string entry = "adView_PlayingVideo URL:" + e.URL; addEntry(entry); }
private void adView_OpeningURL(object sender, MASTAdView.OpeningURLEventArgs e) { string entry = "adView_OpeningURL URL:" + e.URL; addEntry(entry); }
private void adView_LoggingEvent(object sender, MASTAdView.LoggingEventEventArgs e) { string entry = "adView_LoggingEvent LogLevel:" + e.LogLevel + " Entry:" + e.Entry; addEntry(entry); }
private void RefreshPage_Loaded(object sender, RoutedEventArgs e) { object obj = null; if (PhoneApplicationService.Current.State.TryGetValue("refreshAdView", out obj) == true) PhoneApplicationService.Current.State.Remove("refreshAdView"); if (obj == null) throw new ArgumentNullException("refreshAdView"); if (obj is MASTAdView) { adView = (MASTAdView)obj; } else if (obj is List<MASTAdView>) { adViews = (List<MASTAdView>)obj; adView = adViews.ElementAt(0); } else if (obj is MASTAdView[]) { topAdView = ((MASTAdView[])obj)[0]; bottomAdView = ((MASTAdView[])obj)[1]; } if (adView != null) { ZonePanel.Visibility = System.Windows.Visibility.Visible; TopBottomPanel.Visibility = System.Windows.Visibility.Collapsed; ZoneTextBox.Text = adView.Zone.ToString(); } else { ZonePanel.Visibility = System.Windows.Visibility.Collapsed; TopBottomPanel.Visibility = System.Windows.Visibility.Visible; TopZoneTextBox.Text = topAdView.Zone.ToString(); BottomZoneTextBox.Text = bottomAdView.Zone.ToString(); } }