DownloadFileCompleted event doesn't fire inside while loop c# .net
I'm a bit confused why the event doesn't fire when the file has downloaded.

The file it self downloads perfectly fine.

I'm assuming there is some error in the way I am using this, in that the event doesn't fire inside a loop.

Thanks for any help anyone can give me

    
    class DownloadQueue
    {
        public List<string[]> DownloadItems { get; set; }
        public int CurrentDownloads;
        public int DownloadInProgress;
        string url = @"http://www.google.co.uk/intl/en_uk/images/logo.gif";
        bool downloadComplete;

        public DownloadQueue()
        {
            CurrentDownloads = 0;
            DownloadItems = new List<string[]>();
            Console.Write("new download queue made");
        }

        public void startDownloading(int maxSimulatiousDownloads)
        {
            downloadComplete = true;
            DownloadInProgress = 0;
            WebClient client = new WebClient();
            client.DownloadFileCompleted +=
                        new AsyncCompletedEventHandler(this.downloadCompleteMethod);

            
                while(DownloadInProgress != DownloadItems.Count )
                {
                    if (downloadComplete == true)
                    {
                        downloadComplete = false;          

                        client.DownloadFileAsync(new Uri(DownloadItems.ElementAt(DownloadInProgress).ElementAt(0).ToString()), DownloadItems.ElementAt(DownloadInProgress).ElementAt(1).ToString());                        
                    }
                }
            Console.Write("all downloads completed");
        }
        
        private void downloadCompleteMethod(object sender, AsyncCompletedEventArgs e)
        {            
            downloadComplete = true;
            DownloadInProgress++;
            Console.Write("file Downloaded");
        }

        }
DownloadFileCompleted event doesn't fire inside while loop c# .net
===

I'm a bit confused why the event doesn't fire when the file has downloaded.

The file it self downloads perfectly fine.

I'm assuming there is some error in the way I am using this, in that the event doesn't fire inside a loop.

Thanks for any help anyone can give me

    
    class DownloadQueue
    {
        public List<string[]> DownloadItems { get; set; }
        public int CurrentDownloads;
        public int DownloadInProgress;
        string url = @"http://www.google.co.uk/intl/en_uk/images/logo.gif";
        bool downloadComplete;

        public DownloadQueue()
        {
            CurrentDownloads = 0;
            DownloadItems = new List<string[]>();
            Console.Write("new download queue made");
        }

        public void startDownloading(int maxSimulatiousDownloads)
        {
            downloadComplete = true;
            DownloadInProgress = 0;
            WebClient client = new WebClient();
            client.DownloadFileCompleted +=
                        new AsyncCompletedEventHandler(this.downloadCompleteMethod);

            
                while(DownloadInProgress != DownloadItems.Count )
                {
                    if (downloadComplete == true)
                    {
                        downloadComplete = false;          

                        client.DownloadFileAsync(new Uri(DownloadItems.ElementAt(DownloadInProgress).ElementAt(0).ToString()), DownloadItems.ElementAt(DownloadInProgress).ElementAt(1).ToString());                        
                    }
                }
            Console.Write("all downloads completed");
        }
        
        private void downloadCompleteMethod(object sender, AsyncCompletedEventArgs e)
        {            
            downloadComplete = true;
            DownloadInProgress++;
            Console.Write("file Downloaded");
        }

        }