void adHandler_ActivateAdUnit(object sender, ActivateAdUnitEventArgs e)
 {
     var pendingCreatives = GetSubsequentCreatives(e.CreativeSource as IDocumentCreativeSource, e.CreativeConcept as Ad, e.AdSource.Payload as AdDocumentPayload);
     var pendingLinearCreatives = pendingCreatives.TakeWhile(c => c is CreativeLinear).Cast<CreativeLinear>();
     timeAfterAdRemaining = TimeSpan.FromSeconds(pendingLinearCreatives.Sum(lc => lc.Duration.GetValueOrDefault(TimeSpan.Zero).TotalSeconds));
     e.Player.AdRemainingTimeChange += Player_AdRemainingTimeChange;
 }
 void adHandlerBase_ActivateAdUnit(object sender, ActivateAdUnitEventArgs e)
 {
     if (ActivateAdUnit != null)
     {
         ActivateAdUnit(this, e);
     }
 }
示例#3
0
 void Handler_ActivateAdUnit(object sender, ActivateAdUnitEventArgs e)
 {
     ActiveAdPlayer = e.Player;
     try
     {
         if (ActivateAdUnit != null)
         {
             ActivateAdUnit(this, e);
         }
     }
     catch
     {
         ActiveAdPlayer = null;
         throw;
     }
 }
 void adHandlerBase_ActivateAdUnit(object sender, ActivateAdUnitEventArgs e)
 {
     if (ActivateAdUnit != null) ActivateAdUnit(this, e);
 }
 void controller_ActivateAdUnit(object sender, ActivateAdUnitEventArgs e)
 {
     if (OnActivate != null) OnActivate();
     adUnitStack.Push(e.CreativeSource);
 }
 void Handler_ActivateAdUnit(object sender, ActivateAdUnitEventArgs e)
 {
     ActiveAdPlayer = e.Player;
     try
     {
         if (ActivateAdUnit != null) ActivateAdUnit(this, e);
     }
     catch
     {
         ActiveAdPlayer = null;
         throw;
     }
 }
 void controller_ActivateAdUnit(object sender, ActivateAdUnitEventArgs e)
 {
     if (ActivateAdUnit != null) ActivateAdUnit(this, e);
     // show companions
     LoadCompanions(e.Companions, e.SuggestedCompanionRules, e.CreativeSource, e.Player, e.CreativeConcept, e.AdSource);
     // show icons
     if (e.CreativeSource.Icons != null)
     {
         var vpaid2 = e.Player as IVpaid2;
         var preventIcons = vpaid2 != null ? vpaid2.AdIcons : false;
         if (!preventIcons)
         {
             var canellationTokens = new List<CancellationTokenSource>();
             activeIcons.Add(e.Player, canellationTokens);
             foreach (var icon in e.CreativeSource.Icons)
             {
                 var staticResource = icon.Item as StaticResource;
                 if (staticResource != null)
                 {
                     CancellationTokenSource cts = new CancellationTokenSource();
                     canellationTokens.Add(cts);
                     ShowIcon(icon, staticResource, cts);
                 }
             }
         }
     }
 }