How to set in Silverlight WebClient timeout?

How to set in Silverlight WebClient timeout?



int maxRequests = list_S.Count;
// amount of URI
        foreach (string item in list_S)
        {
            bool isValid = Uri.IsWellFormedUriString(item, UriKind.Absolute);
            Uri uriTest;
            if(isValid) //if it is valid Uri, send request
            {
                WebClient wc = new WebClient();
                wc.DownloadStringCompleted += (s, args) =>
                {
                    if (args.Error == null)
                    {
                        dict.Add((int)args.UserState, args.Result);

                    }
                    //here you test if it is the last request... if it is, you can
                    //order the list and use it as you want
                    if (dict.Count == maxRequests)
                    {
                        var orderedResults = dict.OrderBy(a => a.Key);
                    }
                    closeTabitem_SensorSource();
                };
                wc.DownloadStringAsync(new Uri(item), i++);
            }
            else
            {
                MessageBox.Show("Uri FAIL!: " + item);
            }
        }

Comments

Popular posts from this blog

How to build unlimited levels menu through PHP and MySQL

How to build a map of the frequency with which characters occur in a file in OCaml?

How to create timed pop-up windows using MVVM?