public void AddDownload(string version, string size, string url, string path) { DownloadControl downloadControl = new DownloadControl(version, size, url, path); downloadControl.DownloadCompleted += DownloadCompleted; downloadControl.StopDownloadEvent += StopDownloadEvent; downloadControl.StartDownload(); controlList1.Add(downloadControl); }
private void button1_Click(object sender, EventArgs e) { if (MessageBox.Show("您確定要結束目前正在進行的下載?", "詢問", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } for (int i = 0; i < controlList1.list.Count; i++) { DownloadControl a = (DownloadControl)controlList1.list[i]; a.StopDownload(); } controlList1.Clear(); }