private void dataGridViewAttachments_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { var files = (string[])e.Data.GetData(DataFormats.FileDrop); bool addedAttachment = false; foreach (var file in files) { AttachmentForm dlg = new AttachmentForm(issue, type, file); if (dlg.ShowDialog(this) == DialogResult.Cancel) break; else { if (type == DialogType.New) issue.Attachments.Add(dlg.NewAttachment); } addedAttachment = true; } if (addedAttachment) { if (type == DialogType.Edit) UpdateDataFromRedmine(); else AttachAttachements(issue.Attachments); } } }
private void BtnAddButton_Click(object sender, EventArgs e) { AttachmentForm dlg = new AttachmentForm(issue, type, ""); if (dlg.ShowDialog(this) == DialogResult.OK) { if (type == DialogType.Edit) UpdateDataFromRedmine(); else { issue.Attachments.Add(dlg.NewAttachment); AttachAttachements(issue.Attachments); } } }