JamBaseShellListViewBeforeShellDrop Event |
This event is fired before a ListView that inherits from
JamBaseShellListView executes a shell drop.
Namespace: Jam.ShellAssembly: ShellBrowser (in ShellBrowser.dll) Version: 7.2
Syntaxpublic event EventHandler<BeforeShellDropEventArgs> BeforeShellDrop
Public Event BeforeShellDrop As EventHandler(Of BeforeShellDropEventArgs)
public:
event EventHandler<BeforeShellDropEventArgs^>^ BeforeShellDrop {
void add (EventHandler<BeforeShellDropEventArgs^>^ value);
void remove (EventHandler<BeforeShellDropEventArgs^>^ value);
}member BeforeShellDrop : IEvent<EventHandler<BeforeShellDropEventArgs>,
BeforeShellDropEventArgs>Value
EventHandlerBeforeShellDropEventArgs
Remarks
Example
This example shows, how you can rename dropped files automatically.
using Jam.Shell;
using System.IO;
private PathCollection m_DroppedFiles;
private void shellListView1_BeforeShellDrop(object sender, BeforeShellDropEventArgs e)
{
if (m_DroppedFiles != null)
m_DroppedFiles.Clear();
m_DroppedFiles = e.Files;
}
private void shellListView1_OperationPerformed(object sender, OperationEventArgs e)
{
if (e.Operation == ShellOperation.Drop)
{
PathCollection localDroppedFiles = new PathCollection(e.AffectedObjects);
using (ShellBrowser sb = new ShellBrowser())
{
sb.Folder = e.Destination;
foreach (string objectPath in localDroppedFiles)
{
if (m_DroppedFiles != null && m_DroppedFiles.Contains(objectPath))
{
sb.ObjectName = Path.GetFileName(objectPath);
m_DroppedFiles.Delete(m_DroppedFiles.IndexOf(objectPath));
sb.RenameObject("MyNewFileName.txt");
}
}
}
}
}
See Also