public UploadFileItem addUploadItem(DC_FileInformation upload_info) { UploadFileItem control = new UploadFileItem(upload_info) { Dock = DockStyle.Top, Location = new Point(0, 50), ContextMenu = _uploadItemContext, Margin = new Padding(0, 20, 0, 0) }; control.onEnter += delegate(object sender, MouseEventArgs e) { if (Control.ModifierKeys == Keys.Control) { if (selected_upload_items.Contains(control)) { if (e.Button != MouseButtons.Right) { selected_upload_items.Remove(control); } } else { selected_upload_items.Add(control); } } else { if (e.Button != MouseButtons.Right || (e.Button == MouseButtons.Right && !selected_upload_items.Contains(control))) { selected_upload_items.Clear(); selected_upload_items.Add(control); } else if (!selected_upload_items.Contains(control)) { selected_upload_items.Add(control); } } foreach (UploadFileItem loop_control in _panFileItemContainer.Controls) { if (!selected_upload_items.Contains(loop_control)) { loop_control.onLeave(); } } }; control.onDoubleClick += delegate(object sender, EventArgs e) { if (control.file_info.status == DC_FileInformationStatus.Uploaded) { System.Diagnostics.Process.Start(control.file_info.url); } }; _panFileItemContainer.Controls.Add(control); uploading_itmes.Add(control); return(control); }
public UploadFileItem addUploadItem(DC_FileInformation upload_info) { UploadFileItem control = new UploadFileItem(upload_info) { Dock = DockStyle.Top, Location = new Point(0, 50), ContextMenu = _uploadItemContext, Margin = new Padding(0, 20, 0, 0) }; control.onEnter += delegate(object sender, MouseEventArgs e) { if (Control.ModifierKeys == Keys.Control){ if(selected_upload_items.Contains(control)){ if (e.Button != MouseButtons.Right) { selected_upload_items.Remove(control); } }else{ selected_upload_items.Add(control); } }else{ if (e.Button != MouseButtons.Right || (e.Button == MouseButtons.Right && !selected_upload_items.Contains(control))) { selected_upload_items.Clear(); selected_upload_items.Add(control); } else if (!selected_upload_items.Contains(control)) { selected_upload_items.Add(control); } } foreach (UploadFileItem loop_control in _panFileItemContainer.Controls) { if (!selected_upload_items.Contains(loop_control)) { loop_control.onLeave(); } } }; control.onDoubleClick += delegate(object sender, EventArgs e) { if(control.file_info.status == DC_FileInformationStatus.Uploaded) { System.Diagnostics.Process.Start(control.file_info.url); } }; _panFileItemContainer.Controls.Add(control); uploading_itmes.Add(control); return control; }
private void uploadFile(DC_FileInformation file_info) { UploadFileItem control = addUploadItem(file_info); control.startUpload(); }