private void cmiAddShortcut2_Click(object sender, EventArgs e) { frmNewShortcut x = new frmNewShortcut(); if (x.ShowDialog() == DialogResult.OK) { _shortcutOperations2.AddNewShortcut(x.Path, x.Alias); _shortcutOperations2.ReadXMLShortcuts(trvShortcuts2); } }
private void AddNewShortcutOnDragDrop(TreeView senderTreeView, DragEventArgs e, ShortcutOperations shortcutOperations) { // Extract the data from the DataObject-Container into a string list string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); // Do something with the data... // For example add all files into a simple label control: foreach (string File in FileList) { frmNewShortcut x = new frmNewShortcut(); x.Path = File; if (x.ShowDialog() == DialogResult.OK) { shortcutOperations.AddNewShortcut(x.Path, x.Alias); } } shortcutOperations.ReadXMLShortcuts(senderTreeView); }
// Occurs when the user releases the mouse over the drop target void frmMain_DragDrop(object sender, DragEventArgs e) { // Extract the data from the DataObject-Container into a string list string[] FileList = (string[])e.Data.GetData(DataFormats.FileDrop, false); // Do something with the data... // For example add all files into a simple label control: foreach (string File in FileList) { frmNewShortcut x = new frmNewShortcut(); x.Path = File; if (x.ShowDialog() == DialogResult.OK) { AddNewShortcut(x.Path, x.Alias); ReadXMLShortcuts(); } } // this.label.Text += File + "\n"; }