UWP AdMediator

Hi,
i couldn´t find instructions how to insert the UWP AdMediator into Xamarin.Forms, so I used this way:

        RowDefinition gridLineAd;
        UC.AdMedUC adMedUC;
        Microsoft.AdMediator.Universal.AdMediatorControl myAdMediator;
        Grid adWrapper;
        Button btnRemoveAd;

        public MainPage()
        {
            this.InitializeComponent();

            LoadApplication(new TeamOrgaXF.App());


            Grid grid = new Grid();
            grid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });

            gridLineAd = new RowDefinition() { Height = new GridLength(290, GridUnitType.Pixel) };
            grid.RowDefinitions.Add(gridLineAd);

            //XF APP
            var can = this.Content as Canvas;
            this.Content = null;
            grid.Children.Add(can);

            //Wrapper Ad
            adWrapper = new Grid();
            adWrapper.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(30, GridUnitType.Pixel) });
            adWrapper.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(1, GridUnitType.Star) });

            btnRemoveAd = new Button();
            btnRemoveAd.Content = "Remove advertising";
            btnRemoveAd.Tapped += BtnRemoveAd_Tapped;
            adWrapper.Children.Add(btnRemoveAd);

            adMedUC = new UC.AdMedUC();
            myAdMediator = adMedUC.myAdMediator;
            Grid.SetRow(adMedUC, 1);
            adWrapper.Children.Add(adMedUC);

            Grid.SetRow(adWrapper, 1);
            grid.Children.Add(adWrapper);


            this.Content = grid;

            adSize();
            noAd();
        }

Will it cause problems?

Best regards,
Thomas

Sign In or Register to comment.