相当于windows phone 8.0中的adControl.HasAd

时间:2014-05-22 13:51:19

标签: c# windows-phone-8 windows-phone advertising

在Windows Phone 8.1通用应用中,我可以将此代码用于Pub Center广告。

//code behind:
if(adControl.HasAd)
{
}

//xaml:
<UI:AdControl x:Name="adControl" AutoRefreshIntervalInSeconds="60" ApplicationId="" AdUnitId="" HorizontalAlignment="Left" Height="70" IsAutoRefreshEnabled="True" VerticalAlignment="Top" Width="400" Foreground="Black" Background="Black"/>

但是这个功能不适用于Silverlight应用程序。有人知道Windows Phone 8.0应用程序中的“adControl.HasAd”等同物吗?

1 个答案:

答案 0 :(得分:1)

我认为WP8.0中没有相应的内容。您可以做的是拥有自己的bool并使用以下两个事件设置/取消设置:

  

adControl.AdRefreshed:

     

AdControl收到新广告时提出。

  

adControl.ErrorOccured:

     

AdControl收到新广告时提出。

如果您只想在未展示广告时展开广告,也可以使用:

adControl.IsAutoCollapseEnabled = true;