C# 除非试图显示广告

C# 除非试图显示广告,c#,exception,interop,C#,Exception,Interop,我尝试在调用事件时显示广告,使用以下代码: using Microsoft.Advertising.WinRT.UI; . . private InterstitialAd ad; . . Interop.RequestInterstitialEvent += Interop_RequestInterstitialEvent; Interop.ShowInterstitialEvent += Interop_ShowInterstitialEvent; . . . void Interop_Re

我尝试在调用事件时显示广告,使用以下代码:

using Microsoft.Advertising.WinRT.UI;
.
.
private InterstitialAd ad;
.
.
Interop.RequestInterstitialEvent += Interop_RequestInterstitialEvent;
Interop.ShowInterstitialEvent += Interop_ShowInterstitialEvent;
.
.
.
void Interop_RequestInterstitialEvent(object sender, EventArgs e)
{  //When I want to recharge ad
    ad = new InterstitialAd();
    ad.RequestAd(AdType.Video, "d25517cb-12d4-4699-8bdc-52040c712cab", "11389925");
}

void Interop_ShowInterstitialEvent(object sender, EventArgs e)
{ // Show your ad only if it is charging
    if (ad.State == InterstitialAdState.Ready)
    {
        ad.Show();
    }
}
显示以下错误:

确定在
准备就绪后不久何时显示公告,其工作原理相同:

void Interop_RequestInterstitialEvent(object sender, EventArgs e)
{
    ad = new InterstitialAd();
    ad.RequestAd(AdType.Video, "d25517cb-12d4-4699-8bdc-52040c712cab", "11389925");
    ad.AdReady += ad_AdReady;
}

void ad_AdReady(object sender, object e)
{
    ad.Show();
}
但我只想在调用
Interop\u showInterstitutialEvent
时显示它。在该事件中如何显示它