//Create the Ad at runtime and add to the container
        private void CreateAd()
        {
            SDKUtility.LogLevel = LogLevels.IMLogLevelDebug;
            
            IMAdView AdView = new IMAdView();
            
            AdView.AdSize = IMAdView.INMOBI_AD_UNIT_320X50;
           
            //Subscribe for IMAdView events
            AdView.OnAdRequestFailed += AdView_AdRequestFailed;
            AdView.OnAdRequestLoaded += AdView_AdRequestLoaded;
            AdView.OnDismissAdScreen += new EventHandler(AdView_DismissFullAdScreen);
            AdView.OnLeaveApplication += new EventHandler(AdView_LeaveApplication);
            AdView.OnShowAdScreen += new EventHandler(AdView_ShowFullAdScreen);

            
            //Set the AppId. Provide you AppId
            AdView.AppId = "YOUR_APP_ID";
            AdView.RefreshInterval = 20;
            AdView.AnimationType = IMAdAnimationType.SLIDE_IN_LEFT;
            IMAdRequest imAdRequest = new IMAdRequest();
            
            
            
            AdView.LoadNewAd(imAdRequest);

            //Add IMAdView to Container
            stackContainer.Children.Add(AdView);
            
        }
        public static void ShowInmobi(DrawingSurfaceBackgroundGrid DrawingSurfaceBackground)
        {
            //SDKUtility.LogLevel = LogLevels.IMLogLevelDebug;
           // SDKUtility.LogLevel = LogLevels.IMLogLevelDebug;
            if (AdView == null)
            {
                AdView = new IMAdView();           
                AdView.AdSize = IMAdView.INMOBI_AD_UNIT_468x60;
                //Subscribe for IMAdView events
                AdView.OnAdRequestFailed += AdView_AdRequestFailed;
                AdView.OnAdRequestLoaded += AdView_AdRequestLoaded;
                AdView.OnDismissAdScreen += new EventHandler(AdView_DismissFullAdScreen);
                AdView.OnLeaveApplication += new EventHandler(AdView_LeaveApplication);
                AdView.OnShowAdScreen += new EventHandler(AdView_ShowFullAdScreen);
                AdView.VerticalAlignment = VerticalAlignment.Bottom;
                //Set the AppId. Provide you AppId
                AdView.AppId = AdsManager.STR_PUBLISH_ID_INMOBI;
                AdView.RefreshInterval = 20;
                AdView.AnimationType = IMAdAnimationType.SLIDE_IN_LEFT;
                IMAdRequest imAdRequest = new IMAdRequest();
                AdView.LoadNewAd(imAdRequest);
                //Add IMAdView to Container
                DrawingSurfaceBackground.Children.Add(AdView);
            }

        }
Example #3
0
        private object CreateInMobiControl()
        {
            try
            {
                IMAdView AdView = new IMAdView();

                AdView.AdSize = IMAdView.INMOBI_AD_UNIT_480x75;

                //Subscribe for IMAdView events
                //AdView.OnDismissAdScreen += new EventHandler(AdView_DismissFullAdScreen);
                //AdView.OnLeaveApplication += new EventHandler(AdView_LeaveApplication);
                //AdView.OnShowAdScreen += new EventHandler(AdView_ShowFullAdScreen);


                //Set the AppId. Provide you AppId
                AdView.AppId = InMobiAppId;
                AdView.RefreshInterval = 20;
                AdView.AnimationType = IMAdAnimationType.NONE;
                IMAdRequest imAdRequest = new IMAdRequest();
                AdView.LoadNewAd(imAdRequest);
                return AdView;
            }
            catch (Exception)
            {
                return new Model.NoneProvider();
            }
        }