Chat Support
Loupe - Log - Monitor - Resolve
Loupe / Developer's Guide / Extending Loupe Server / Commands / Loupe Extensions - Global Commands
In This Topic
    Loupe Extensions - Global Commands
    In This Topic

    Global Commands can be directly executed within Loupe Desktop and show in the main menu.  They can access your Global Controller (if defined) but little else since configuration is held at the Repository level.  For a general overview of how Extension commands work, see Loupe Extensions - Commands.

    Because these commands are invoked directly by the end user from the user interface they can have their own user interface or be purely background.

    What You Need to Implement

    To create a Global Command, you need to create a class that:

    For more information on how classes are evaluated and loaded see Loupe Extensions - Deploying Extensions.

    Extension Lifecycle

    1. After your extension has been initialized and before an extensible user interface is displayed the command's Initialize Method will be called.  Then it is eligible to be invoked for processing. 
    2. When an extensible part of the user interface is being composed each extension will be requested to register its commands using its RegisterCommands Method.  All commands that the Extension supports must be recorded during this method by calling the provided IUserInterfaceController object's RegisterCommand method. 
    3. Each time an extensible part of the user interface is displayed a BeforeCommandsDisplay Method call will be made to each Extension to allow for selectively enabling / disabling commands, changing labels and tooltips.  When a command is disabled it won't show in context menus.  To update a command, call the provided IUserInterfaceController object's UpdateCommand method.  It isn't necessary to update any commands - if not updated they will keep their previous configuration.
    4. If a user selects a command its Process method will be invoked. 
      • If the command's isUserInteractive option was set true during registration then no user interface will be provided and the command will be executed on the UI thread.  It is recommended that if this configuration is used a user interface should be provided that will appropriately perform background processing for long-running tasks to ensure the UI remains responsive.
      • If the command's isUserInteractive option was set false during registration then the command will be executed on a background thread with a progress user interface displayed to keep the user interface refreshing.  In this configuration it isn't recommended that any user interface beyond a simple message box be employed. 
    5. If a global command extension has been loaded, even if it was never initialized, it will be disposed when it is released. 

    Notes and Best Practices

    Caching Information

    If it's useful to cache information to improve performance the best place to do this is in a Global Controller.  This allows the cache to be shared between all of the classes that make up your extension.  Your global command can cache information however it's important to do so in a thread safe manner because the Process method must be threadsafe and re-entrant.

    Global Scope

    A single instance of a global command is associated with exactly one Global Context.  This means its not associated with any particular repository.  You can use the context to interact with the default repository and user interface, including displaying sessions in the session viewer and requesting that the configuration of the Extension be edited.

    Managing State

     

    See Also