private void BottomRefreshButton_Click(object sender, RoutedEventArgs e) { int zone = int.Parse(BottomZoneText.Text); Page samplePage = sampleFrame.Content as Page; MASTAdView adView = samplePage.FindName("adViewBottom") as MASTAdView; if (adView != null) { adView.Zone = zone; adView.Update(); } this.TopAppBar.IsOpen = false; this.BottomAppBar.IsOpen = false; }
private void RefreshButton_Click(object sender, RoutedEventArgs e) { int zone = int.Parse(ZoneText.Text); Page samplePage = sampleFrame.Content as Page; MASTAdView adView = samplePage.FindName("adView") as MASTAdView; if (adView != null) { adView.Zone = zone; adView.Update(); } else { MethodInfo refreshMethod = samplePage.GetType().GetRuntimeMethod("Refresh", new Type[] { typeof(int) }); if (refreshMethod != null) { refreshMethod.Invoke(samplePage, new object[] { zone }); } } this.TopAppBar.IsOpen = false; this.BottomAppBar.IsOpen = false; }
private void CustomDoneButton_Click(object sender, RoutedEventArgs e) { Page samplePage = sampleFrame.Content as Page; MASTAdView adView = samplePage.FindName("adView") as MASTAdView; if (UseInternalBrowserCheckBox.IsChecked.HasValue) { adView.UseInteralBrowser = (bool)UseInternalBrowserCheckBox.IsChecked; } if (UseLocationDetectionCheckBox.IsChecked.HasValue) { adView.LocationDetectionEnabled = (bool)UseLocationDetectionCheckBox.IsChecked; } string value = xTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.Margin = new Thickness(0, adView.Margin.Top, adView.Margin.Right, adView.Margin.Bottom); } else { adView.Margin = new Thickness(double.Parse(value), adView.Margin.Top, adView.Margin.Right, adView.Margin.Bottom); } value = yTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.Margin = new Thickness(adView.Margin.Left, 0, adView.Margin.Right, adView.Margin.Bottom); } else { adView.Margin = new Thickness(adView.Margin.Left, double.Parse(value), adView.Margin.Right, adView.Margin.Bottom); } value = widthTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Stretch; adView.Width = Double.NaN; } else { adView.HorizontalAlignment = Windows.UI.Xaml.HorizontalAlignment.Center; adView.Width = int.Parse(value); } value = heightTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top; adView.Height = 100; } else { adView.VerticalAlignment = Windows.UI.Xaml.VerticalAlignment.Top; adView.Height = int.Parse(value); } value = maxWidthTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.AdRequestParameters.Remove("size_x"); } else { adView.AdRequestParameters["size_x"] = value; } value = maxHeightTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.AdRequestParameters.Remove("size_y"); } else { adView.AdRequestParameters["size_y"] = value; } value = minWidthTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.AdRequestParameters.Remove("min_size_y"); } else { adView.AdRequestParameters["min_size_y"] = value; } value = minHeightTextBox.Text; if (string.IsNullOrWhiteSpace(value)) { adView.AdRequestParameters.Remove("min_size_x"); } else { adView.AdRequestParameters["min_size_x"] = value; } CustomPopup.IsOpen = false; System.Threading.Tasks.Task.Run(async delegate() { await System.Threading.Tasks.Task.Delay(500); await Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, delegate() { adView.Update(); }); }); }