Your Extension can define many commands to extend the Loupe Desktop user interface. There are three types of commands you can create:
While they have different scopes which provide the context they can operate within the basic design of commands is the same. Each command must:
The primary way that commands are displayed is in menus - either context menus or the main menu of the application. They are displayed in a predictable order based on the order they are registered in. Hierarchal menus can be created by using periods (.) in the command name to separate the name of each menu level and backslash (\) in the label.
You can add visual distinction to your commands by providing an icon for them. The icon will automatically be sized to the available space; for best results provide a 16x16 and 32x32 pixel, 32-bit optimized image in your icons.
Frequently you'll want to group like commands together and separate them from the rest of the commands with a divider. All of the commands you register are automatically placed in a single group when displayed and divided from other commands in the same menu. In addition, each command you register can optionally specify a command group. All of the commands without a group will be displayed first then the groups, in the order they were provided. In other words, commands are sorted first by group registration order then command registration order.
If your command should be run on the main UI thread of the Loupe Desktop and can display its own user interface then specify the isUserInteractive=true option when registering it. In this mode you should implement normal best practices to keep the UI responsive while your command is executing, particularly if you are performing a long running task.
If you do not need to display a user interface (beyond a MessageBox which is safe from any thread) then you should specify the isUserInteractive=false option when registering. In this mode you will be called on a background thread and a general marquee progress bar will be displayed to let the user know your command is executing.
If you want to display an error during command execution, often the best thing to do is simply throw an exception back to Loupe. This will cause it to be logged and the Loupe Error Manager will be displayed to the user so they can decide what to do next.