Пример #1
0
        void contexMenu_RestartItemClicked(object sender, EventArgs e)
        {
            int index = _restartItems.IndexOf((ToolStripItem)sender);

            if (index >= 0)
            {
                if (!_webClients[index].IsBusy)
                {
                    ModifyProgressBarColor.SetState(_progressBars[index], 1);
                    _progressBars[index].Value = _progressBars[index].Minimum;
                    _labels[index].Text        = _files[index];
                    panelDownloads.ScrollControlIntoView(_progressBars[index]);
                    _startTimes[index] = DateTime.Now;
                    using (_webClients[index])
                    {
                        _webClients[index].DownloadProgressChanged += wc_DownloadProgressChanged;
                        _webClients[index].DownloadFileCompleted   += wc_DownloadCompleted;
                        _webClients[index].DownloadFileAsync(new System.Uri(_URIs[index]), _paths[index] + _files[index]);
                    }
                    _finished[index] = false;
                    _parentform.DisAllowClosing();
                }
            }
        }