Nevron .NET Vision Documentation
Command Model

Overview
Since 2006 Q1 release Nevron Docking Panels library has been greatly improved. One cool new feature is the command model and the NDockingFrameworkCommander object which exposes some predefined actions and allows you to define your own custom ones as well as to specify keyboard combination(s) for each NDockingFrameworkCommand instance.
The NDockingFrameworkCommand Object
This is a simple object which exposes only two significant methods - Execute and CanExecute. It also contains an array of shortcuts associated with it and whenever these keys are pressed the command's Execute method is called.
The NDockingFrameworkCommander Object

All commands are contained by a NDockingFrameworkCommander instance, member of the NDockManager. It contains methods for command execution by keys, by id, by name, etc. All the commands are kept by id and if you attempt to register a command which has an id already contained the previous command will be removed.

 

The following code demonstrates how to create and register a custom command: 

C#
Copy Code
NDockingFrameworkCommand command = new NDockingFrameworkCommand();
command.ID = (int)MyCommandIdEnum.Command1;
//add a shortcut combination
command.Shortcuts.Add(new NShortcut(Keys.Q, Keys.Control | Keys.Shift));
//hook to the executed event
command.Executed += new EventHandler(OnMyCommandCommandExecuted);
this.nDockManager1.Commander.RegisterCommand(command);

private void OnMyCommandCommandExecuted(object sender, EventArgs e)
{
    MessageBox.Show("My command is executed...");
}
Visual Basic
Copy Code
Dim command As NDockingFrameworkCommand = New NDockingFrameworkCommand()
command.ID = CInt(MyCommandIdEnum.Command1)
'add a shortcut combination
command.Shortcuts.Add(new NShortcut(Keys.Q, Keys.Control Or Keys.Shift))
'hook to the executed event
AddHandler command.Executed, AddressOf OnMyCommandCommandExecuted
Me.nDockManager1.Commander.RegisterCommand(command)

Private Sub OnMyCommandCommandExecuted(ByVal sender As Object, ByVal e As EventArgs) Handles commandExecuted
    MessageBox.Show("My command is executed...")
End Sub
You may also hook to the command's Executing event, set the arguments' Cancel property to true and prevent the command from being executed.
Predefined Commands

The following table describes the predefined commands registered with the framework:

ID Command Name Shortcut(s)
0 NextPanel Alt + F6
1 NextDocument Ctrl + Tab, Ctrl + F6
2 NextPanelTab Ctrl + Num+
3 NextDocumentTab Ctrl + Shift + Num+
4 PreviousPanel Alt + Shift + F6
5 PreviousDocument Ctrl + Shift + Tab, Ctrl + Shift + F6
6 PreviousPanelTab Ctrl + Num-
7 PreviousDocumentTab Ctrl + Shift + Num-
8 ClosePanel Shift + Esc
9 CloseDocument Ctrl + F4
10 CloseAllDocuments None
11 DocumentTileHorizontal None
12 DocumentTileVertical None
13 DocumentCascade None
14 DocumentArrangeIcons None
Built-in Keyboard Editor

The NDockingFrameworkCommander comes with a built-in editor which visually allows to edit the shortcut combinations associated with a command.

 

The following code demonstrates how to display this editor: 

C#
Copy Code
this.nDockManager1.Commander.ShowKeyboardEditor();
Visual Basic
Copy Code
Me.nDockManager1.Commander.ShowKeyboardEditor()

 

Remarks
This model allows for easy and flexible managing of custom actions.
See Also

 

 


©2017. Nevron Software LLC.

Send Feedback