private void btnDownload_Click(object sender, EventArgs e) { List <DataGridViewRow> checkedRows = GetCheckedRows(); String ids = String.Empty; if (checkedRows.Count > 0) { if (Settings.MAX_DOWNLOAD >= checkedRows.Count) { ids = string.Join("|", checkedRows.Select(row => row.Cells[0].Value.ToString())); Console.WriteLine("ids: {0}", ids); // loop for each checked row and send download request foreach (DataGridViewRow row in checkedRows) { string id = row.Cells[0].Value.ToString(); Console.WriteLine("id to send to server {0}", id); Socket socket = InitializeClientSocket(); Send(socket, id); sendDone.WaitOne(); Receive(socket, id); receiveDone.WaitOne(); Thread.Sleep(1000); } DownloadCompleteDialog downloadCompleteDialog = new DownloadCompleteDialog(); downloadCompleteDialog.ShowDialog(); } else { // MAX allowed downloads exceeded string message = "Number of files selected:" + checkedRows.Count + " exceeds MAX:" + Settings.MAX_DOWNLOAD + " simultaneous download limit"; string caption = "Max simultaneous download limit exceeded"; MessageBoxButtons buttons = MessageBoxButtons.OK; MessageBox.Show(message, caption, buttons); } } else { string message = "There are no selected files for download."; string caption = "Error detected in input"; MessageBoxButtons buttons = MessageBoxButtons.OK; DialogResult dialogResult = MessageBox.Show(message, caption, buttons); } }
public IDownloadCompleteDialog CreateDownloadCompleteDialog() { var win = DownloadCompleteDialog.CreateFromGladeFile(); return(win); }