Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="AdduplexAdUnitId"></param>
        /// <param name="AdduplexSDKKey"></param>
        /// <param name="PubcenterApplicationId"></param>
        /// <param name="PubcenterSDKKey"></param>
        /// <param name="PubcenterMobileApplicationId"></param>
        /// <param name="PubcenterMobileSDKKey"></param>
        public async void Initialize(string AdduplexAdUnitId, string AdduplexSDKKey,
                                     string PubcenterApplicationId, string PubcenterSDKKey,
                                     string PubcenterMobileApplicationId, string PubcenterMobileSDKKey)
        {
            // Initialize pubcenter
            interstitialAd_pubcenter                = new InterstitialAd();
            interstitialAd_pubcenter.AdReady       += InterstitialAdMain_AdReady;
            interstitialAd_pubcenter.ErrorOccurred += InterstitialAdMain_ErrorOccurred;
            interstitialAd_pubcenter.Completed     += InterstitialAdInterstitialAdMain_Completed;
            interstitialAd_pubcenter.Cancelled     += InterstitialAdInterstitialAdMain_Cancelled;

            interstitialAd_pubcenter.Keywords = tags;
            if (AnalyticsInfo.VersionInfo.DeviceFamily == "Windows.Mobile")
            {
                interstitialAd_pubcenter.RequestAd(Microsoft.Advertising.WinRT.UI.AdType.Video, PubcenterMobileApplicationId, PubcenterMobileSDKKey);
            }
            else
            {
                interstitialAd_pubcenter.RequestAd(Microsoft.Advertising.WinRT.UI.AdType.Video, PubcenterApplicationId, PubcenterSDKKey);
            }

            // Initialize Adduplex
            AdDuplex.AdDuplexClient.Initialize(AdduplexSDKKey);
            interstitialAd_adduplex = new AdDuplex.InterstitialAd(AdduplexAdUnitId);

            interstitialAd_adduplex.NoAd           += InterstitialAd_adduplex_NoAd;
            interstitialAd_adduplex.AdClicked      += InterstitialAd_adduplex_AdClicked;
            interstitialAd_adduplex.AdClosed       += InterstitialAd_adduplex_AdClosed;
            interstitialAd_adduplex.AdLoadingError += InterstitialAd_adduplex_AdLoadingError;

            InterstitialAdInfo info = await interstitialAd_adduplex.LoadAdAsync();

            // Events
            HockeyClient.Current.TrackEvent("Ads requested");
        }
Ejemplo n.º 2
0
 public InterstitialAd(AdInfo adInfo)
 {
     this.adInfo            = adInfo;
     Context                = new MSAd.InterstitialAd();
     Context.AdReady       += InterstitialAd_AdReady;
     Context.ErrorOccurred += InterstitialAd_ErrorOccurred;
     Context.Completed     += InterstitialAd_Completed;
     Context.Cancelled     += InterstitialAd_Cancelled;
 }
Ejemplo n.º 3
0
        /// <summary>
        /// Cleanup
        /// </summary>
        public void Destroy()
        {
            if (interstitialAd_pubcenter != null)
            {
                interstitialAd_pubcenter.AdReady       -= InterstitialAdMain_AdReady;
                interstitialAd_pubcenter.ErrorOccurred -= InterstitialAdMain_ErrorOccurred;
                interstitialAd_pubcenter.Completed     -= InterstitialAdInterstitialAdMain_Completed;
                interstitialAd_pubcenter.Cancelled     -= InterstitialAdInterstitialAdMain_Cancelled;

                interstitialAd_pubcenter = null;
            }
            if (interstitialAd_adduplex != null)
            {
                interstitialAd_adduplex = null;
            }
        }