LoadRequest() 개인적인 메소드

private LoadRequest ( GADRequest request ) : void
request GADRequest
리턴 void
예제 #1
0
        /// <summary>
        /// reload the view and hit up google admob 
        /// </summary>
        /// <param name="e"></param>
        protected override void OnElementChanged(ElementChangedEventArgs<Xamarin.Forms.View> e)
        {
            base.OnElementChanged(e);

            //convert the element to the control we want
            var adMobElement = Element as AdMobBuddyControl;

            if (null != adMobElement) //TODO: does need this check here?
            {
                adView = new GADBannerView(size: GADAdSizeCons.Banner)
                {
                    AdUnitID = adMobElement.AdUnitId,
                    RootViewController = UIApplication.SharedApplication.Windows[0].RootViewController
                };

                adView.DidReceiveAd += (sender, args) =>
                {
                    if (!viewOnScreen) this.AddSubview(adView);
                    viewOnScreen = true;
                };

                adView.LoadRequest(GADRequest.Request);
                base.SetNativeControl(adView);
            }
        }
예제 #2
0
        protected override void OnElementChanged(ElementChangedEventArgs<View> e)
        {
            base.OnElementChanged(e);

            var adMobElement = Element as AdmobBannerView;

            if (null != adMobElement)
            {
                adView = new GADBannerView(GADAdSizeCons.Banner)
                {
                    AdUnitID = adMobElement.AdUnitID,
                    RootViewController = UIApplication.SharedApplication.Windows[0].RootViewController
                };

                adView.AdReceived += (sender, args) =>
                {
                    if (!viewOnScreen)
                        AddSubview(adView);
                    viewOnScreen = true;
                };

                adView.LoadRequest(GADRequest.Request);
                SetNativeControl(adView);
            }                
        }
예제 #3
0
파일: BannerAd.cs 프로젝트: fordream/Locks
        private static void InitializeBannerAd()
        {
            UIWindow mainWindow = UIApplication.SharedApplication.KeyWindow;
            UIViewController rootViewController = mainWindow.RootViewController;
            UIView rootView = rootViewController.View;

            // Setup your GADBannerView, review GADAdSizeCons class for more Ad sizes.
            float bannerAdHeight = 60f;
            BannerAdView = new GADBannerView (size: GADAdSizeCons.SmartBannerLandscape);
            BannerAdView.Hidden = true;
            BannerAdView.AdUnitID = BannerAdUnitId;
            BannerAdView.Frame = new RectangleF (0, rootView.Frame.Width - bannerAdHeight, rootView.Frame.Height, bannerAdHeight + 1);
            BannerAdView.RootViewController = rootViewController;

            // Wire DidReceiveAd event to know when the Ad is ready to be displayed
            BannerAdView.DidReceiveAd += (object sender, EventArgs e) => {
                if (!BannerAdAlreadyAddedToWindow) {
                    rootView.AddSubview (BannerAdView);
                    BannerAdAlreadyAddedToWindow = true;
                }
                BannerAdAvailable = true;
                BannerAdView.Hidden = HideBannerAd;
            };

            BannerAdView.DidFailToReceiveAd += (object sender, GADBannerViewErrorEventArgs e) => {
                BannerAdAvailable = false;
                Hide();
            };

            //GADRequest.Request.TestDevices = new string[] { "faa970547eb47b57b855e5ca9e3b8bc7" };
            BannerAdView.LoadRequest (GADRequest.Request);
        }
예제 #4
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Title = AppDelegate.its.getTranslatedText ("Help");

            Background back = new Background ();
            this.View.AddSubview (back.View);
            this.View.SendSubviewToBack (back.View);

            if (AppDelegate.Variant == "LITE") {
                adView = new GADBannerView (size: GADAdSizeCons.Banner, origin: new PointF (0, 66)) {
                    AdUnitID = AppDelegate.AdmobID,
                    RootViewController = this
                };

                adView.DidReceiveAd += (sender, args) => {
                    if (!viewOnScreen) View.AddSubview (adView);
                    viewOnScreen = true;
                };

                adView.LoadRequest (GADRequest.Request);
            }

            HelpScreenInner innerViewController = new HelpScreenInner ();
            UIScrollView innerScroll = new UIScrollView (View.Bounds);
            innerScroll.ContentSize = innerViewController.GetContentSize ();
            innerScroll.AddSubview (innerViewController.View);
            innerScroll.UserInteractionEnabled = true;
            View.AddSubview (innerScroll);

            UIBarButtonItem YouTube = new UIBarButtonItem ("YouTube", UIBarButtonItemStyle.Plain, null);
            YouTube.Clicked += (object sender, System.EventArgs e) => UIApplication.SharedApplication.OpenUrl (new MonoTouch.Foundation.NSUrl ("https://www.youtube.com/watch?v=aq1Ml2O8ado"));
            this.NavigationItem.SetRightBarButtonItem (YouTube,true);
        }
예제 #5
0
        public override bool FinishedLaunching(UIApplication application, NSDictionary launchOptions)
        {
            vc = new UIViewController();

            window = new UIWindow (UIScreen.MainScreen.Bounds);
            window.RootViewController = vc;
            window.MakeKeyAndVisible ();

            bannerView = new GADBannerView(new RectangleF(new PointF(0,vc.View.Frame.Height - GADBannerView.GAD_SIZE_320x50.Height),GADBannerView.GAD_SIZE_320x50));
            bannerView.AdUnitID = "MY_BANNER_UNIT_ID";
            bannerView.RootViewController = vc;

            vc.View.AddSubview(bannerView);
            bannerView.LoadRequest(new GADRequest());

            return true;
        }
예제 #6
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad ();

            Title = AppDelegate.its.getTranslatedText ("Indexer Dashboard");
            this.NavigationController.NavigationBar.Translucent = true;

            Background back = new Background ();
            Add (back.View);
            View.SendSubviewToBack (back.View);

            float mapHeight = 200;
            const float navbarHeight = 100;
            const float panelContentHeight = 1000;

            if (!UserInterfaceIdiomIsPhone) {
                mapHeight = 450;
            }

            MainMap = new OverSightMap (new RectangleF (10, navbarHeight, UIScreen.MainScreen.Bounds.Width - buffer * 2, mapHeight), this);
            View.AddSubview (MainMap.View);

            if (AppDelegate.Variant == "LITE") {
                adView = new GADBannerView (size: GADAdSizeCons.Banner, origin: new PointF (0, navbarHeight + mapHeight)) {
                    AdUnitID = AppDelegate.AdmobID,
                    RootViewController = this
                };

                adView.DidReceiveAd += (sender, args) => {
                    if (!viewOnScreen) View.AddSubview (adView);
                    viewOnScreen = true;
                };

                adView.LoadRequest (GADRequest.Request);
            }

            float statpanelwidth = UIScreen.MainScreen.Bounds.Width / 3;
            float rightPanelWidth = UIScreen.MainScreen.Bounds.Width - statpanelwidth - 3*buffer;
            const float headerheight = 100;
            float panelsHeight = UIScreen.MainScreen.Bounds.Height - mapHeight - buffer;
            const float panelY = headerheight + buffer;
            statpanel = new StatisticsPanel (new SizeF(statpanelwidth,panelContentHeight));
            statpanelScroll = new UIScrollView (new RectangleF(buffer, mapHeight + buffer + navbarHeight, statpanelwidth, panelsHeight));
            statpanelScroll.AddSubview (statpanel.View);
            //			foreach (UIGestureRecognizer uig in statpanel.View.GestureRecognizers) {
            //				uig.Delegate = new SwipeDelegate ();
            //			}
            statpanelScroll.ContentSize = new SizeF (statpanelwidth, panelContentHeight);
            statpanelScroll.UserInteractionEnabled = true;
            View.AddSubview (statpanelScroll);

            rightPanelRect = new RectangleF (statpanelwidth + buffer, mapHeight + buffer + navbarHeight, rightPanelWidth, panelsHeight);
            rightPanel = new DashboardRightPanel (rightPanelWidth, this);

            //			DashBoardHeader header = new DashBoardHeader (new RectangleF(0, 20 ,UIScreen.MainScreen.Bounds.Width, 22));
            //			View.AddSubview (header.View);

            AddSearchBar ();
            //			search.AutosizesSubviews = false;
            //			search.SizeToFit ();

            View.AddSubview (Search);

            rightPanelScroll = new UIScrollView (rightPanelRect);
            rightPanelScroll.ContentSize = rightPanel.getSize ();
            rightPanelScroll.AddSubview (rightPanel.View);
            rightPanelScroll.ShowsVerticalScrollIndicator = false;
            rightPanelScroll.UserInteractionEnabled = true;
            View.AddSubview (rightPanelScroll);

            menu = new IndexerSateliteMenu ("Dashboard", this);
            menu.View.UserInteractionEnabled = true;
            //			foreach (UIGestureRecognizer uig in menu.View.GestureRecognizers) {
            //				uig.Delegate = new SwipeDelegate ();
            //			}
            View.AddSubview (menu.View);

            AddHelpButton ();
            AddSettingsButton ();

            curtainsIsDown = true;
            PullDownCurtain ();
            if (UserInterfaceIdiomIsPhone) {
                menu.SateliteButton.TouchUpInside += (object sender, EventArgs e) => ToggleCurtains ();
            }
        }
예제 #7
0
        void InitializeAdds()
        {
            PointF origo;
            GADAdSize type;
            if (UserInterfaceIdiomIsPhone) {
                origo = new PointF (0, UIScreen.MainScreen.Bounds.Height);
                type = GADAdSizeCons.Banner;
            } else {
                origo = new PointF (0, UIScreen.MainScreen.Bounds.Height);
                type = GADAdSizeCons.FullBanner;
            }

            adView = new GADBannerView (size: type, origin: origo) {
                AdUnitID = AppDelegate.AdmobID,
                RootViewController = this
            };

            adView.DidReceiveAd += (sender, args) => {
                if (!viewOnScreen) View.AddSubview (adView);
                viewOnScreen = true;
            };

            adView.LoadRequest (GADRequest.Request);
        }