小编Fir*_*ren的帖子

如何异步检索多个网站?

使用Silverlight Windows Phone 8.1项目

我正在尝试从网站加载数据.不过,我必须首先在该网站进行身份验证.所以我在网站上发帖子,使用这里的CookieAwareWebClient的轻微修改版本.

class CookieAwareWebClient : WebClient
{
    public CookieContainer Cookies = new CookieContainer();

    protected override WebRequest GetWebRequest(Uri address)
    {
        var request = base.GetWebRequest(address);
        if (request is HttpWebRequest)
            (request as HttpWebRequest).CookieContainer = Cookies;

        return request;
    }
}
Run Code Online (Sandbox Code Playgroud)

现在我做的WebClient发送POSTUsernamePassword继续让我的网站async和我的处理现场数据DownloadStringCompleted-EventHandler.到现在为止还挺好.现在我想扩展它并获得多个网站. 我不必一次性完成所有这些,事实上,让它们一个接一个地更好.

但我不知道该怎么做.

我的代码到目前为止:

using System;
using System.Net;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using Windows.Web.Http;
using Microsoft.Phone.Shell;
using StackOverflowApp.Resources;

namespace StackOverflowApp
{ …
Run Code Online (Sandbox Code Playgroud)

c# cookies asynchronous webclient windows-phone-8.1

9
推荐指数
1
解决办法
407
查看次数

IsEnabled绑定更新后按钮未启用

我有一堂课叫做Document

public class Document : INotifyPropertyChanged
{                  
    public event PropertyChangedEventHandler PropertyChanged;
    private void NotifyPropertyChanged(string propertyName)
    {
        if (PropertyChanged != null)
            PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }             

    private string oldId;
    public string OldId
    {
        get { return oldId; }
        set { id = value; }
    }

    private string id;
    public string Id
    {
        get { return id; }
        set { 
            id = value;
            NotifyPropertyChanged("HasChanged");
        }
    }

    private string path;
    public string Path
    {
        get { return path; }
        set { path = …
Run Code Online (Sandbox Code Playgroud)

c# wpf binding button

0
推荐指数
1
解决办法
466
查看次数