Click or drag to resize

ShellBrowserOnBeforeInvokeCommand Method

This method is called to trigger the BeforeShellCommand event.

Namespace:  Jam.Shell
Assembly:  ShellBrowser (in ShellBrowser.dll) Version: 6.3.1
Syntax
public override void OnBeforeInvokeCommand(
	BeforeShellCommandEventArgs e
)

Parameters

e
Type: Jam.ShellBeforeShellCommandEventArgs
Event information to send to registered event handlers.

Implements

IShellCommandInvokableOnBeforeInvokeCommand(BeforeShellCommandEventArgs)
Examples
Shows the usage of the BeforeShellCommand event.
C#
using (ShellBrowser shellBrowser = new ShellBrowser(lFilePath))
{
    //The following code shows some variants to stop a context menu item from being executed.
    shellBrowser.BeforeShellCommand += (s, e) =>
    {
        if (e.Verb == ShellCommand.Open)
            e.Cancel = true;
        //this is equivalent to:
        if (e.Verb == ShellContextMenuCommand.Open)
            e.Cancel = true;
        //or
        if (ShellCommand.IsOpen(e.Verb))
            e.Cancel = true;

        //not all context menu commands have a "verb". If it is empty, then you can at least access the caption:
        if (ShellCommand.IsEmpty(e.Verb))
            System.Diagnostics.Debug.WriteLine(e.Verb.Caption);
    };
    shellBrowser.ShowContextMenu(Cursor.Position);
}
See Also