Windows phone 7 DownloadStringCompleted事件未触发

Windows phone 7 DownloadStringCompleted事件未触发,windows-phone-7,webclient,Windows Phone 7,Webclient,我正在开发一个windows phone应用程序。webclient没有像我预期的那样启动。相关代码如下: public PArticle(PocketListItem aPli) { this.pli = aPli; using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication()) { if (!isf.FileE

我正在开发一个windows phone应用程序。webclient没有像我预期的那样启动。相关代码如下:

public PArticle(PocketListItem aPli)
    {
        this.pli = aPli;

        using (IsolatedStorageFile isf = IsolatedStorageFile.GetUserStoreForApplication())
        {
            if (!isf.FileExists(aPli.ID + ".json"))
            {
                WebClient client = new WebClient();
                client.DownloadStringCompleted += new DownloadStringCompletedEventHandler(client_DownloadStringCompleted);
                client.DownloadStringAsync(new Uri(pli.Url));
            }
            else
            {
                string json = RetrieveDataFromLocalStorage(aPli.ID + ".json");

                PocketArticle pa = JsonConvert.DeserializeObject<PocketArticle>(json);
                this.text = pa.text;
            }
        }
    }

    void client_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
    {
        var readability = Readability.Create(e.Result);
        this.text = readability.Content;
    }
公共粒子(PocketListItem aPli)
{
this.pli=aPli;
使用(IsolatedStorageFile isf=IsolatedStorageFile.GetUserStoreForApplication())
{
如果(!isf.FileExists(aPli.ID+“.json”))
{
WebClient客户端=新的WebClient();
client.DownloadStringCompleted+=新的DownloadStringCompletedEventHandler(client\u DownloadStringCompleted);
DownloadStringAsync(新Uri(pli.Url));
}
其他的
{
字符串json=RetrieveDataFromLocalStorage(aPli.ID+“.json”);
PockeArticle pa=JsonConvert.DeserializeObject(json);
this.text=pa.text;
}
}
}
无效客户端\u DownloadStringCompleted已完成(对象发送方,DownloadStringCompletedEventArgs e)
{
var readability=readability.Create(即结果);
this.text=readability.Content;
}
我知道这是一个同步/异步问题。但我不知道该怎么处理


提前感谢。

我已经用两个不同的URL和URL测试了代码的WebClient部分。在这两种情况下,都会引发DownloadStringCompleted事件。我通过放置一个断点来观察它


所以我建议你用断点再次测试

代码似乎很好,检查你的Url是否有效?我认为这是笑料:然而,在那篇文章中没有给出解决方案。url没有问题。