Nevron .NET Vision
Chart for .NET / Getting Started / Integrating in Windows Forms / NChartCommandBarsManager / Commands and Command Bars Manager

In This Topic
    Commands and Command Bars Manager
    In This Topic
    Commands are used to facilitate the implementation of any chart user action, which can be performed from a menu, toolbar or context menu. The chart commands implementation is not bound to the Nevron User Interface, which makes it possible to reuse them with other UI suites. All chart commands derive from the base NChartCommand class. Chart commands can, in general, be classified as follows:
    • Button Commands - these are commands, which are performed on single button click events. They implement the INChartButtonCommand interface, a core implementation of which can be found in the NChartButtonCommand class.
    • Check Button Commands - these are button commands, which have a checked state. They implement the INChartCheckButtonCommand interface, a core implementation of which can be found in the NChartCheckButtonCommand class.
    • Combo Box Commands - these are commands, which are visually represented as a combo box and can be used to perform an operation, which can accept several options. They implement the INChartComboCommand interface a core implementation of which can be found in the NChartComboCommand class.
    • Menu Commands - these are commands, which can host several other commands and are usually displayed in menus. They implement the INChartMenuCommand interface a core implementation of which can be found in the NChartMenuCommand class.
    • Option Menu Commands - these are menu commands, the items of which are the options from which the user can select. They implement the INChartOptionMenuCommand interface a core implementation of which can be found in the NChartOptionMenuCommand class.

    Based on the operation they perform, commands are also grouped in ranges. The command ranges currently available are enumerated by the ChartCommandRange enumeration. The commands currently implemented are enumerated by the ChartCommand enumeration. It is important to remember that each chart command has an id and range (exposed by the Id and RangeId properties).

     Chart commander

    The chart commander (hereafter referred to as commander) is represented by an instance of the NChartCommander class. It serves as a bridge between the Nevron User Interface and the chart commands. The commander maintains a collection of chart commands, which is accessible from its Commands property. Initially it contains all currently implemented commands (see the Chart Commands topic for more information).

    Currently the commander can be used to control an instance of the NChartControl class. The controlled chart is specified by the ChartControl property of the commander.

    Several properties of the commander control the steps with, which certain commands modify the chart settings. These are:

    RotationStep - controls the step of all rotation operations (left, right, viewer rotation left and viewer rotation right)

    ElevationStep - controls the step of the elevation operations (up and down)

    OffsetStep - controls the step of the offset operations (left, right, up, down)

    ZoomStep - controls the step of the zoom operations (zoom in, zoom out)

    ChartSizeStep - controls the step of the chart resize operations (increase / decrease chart width, height, depth)

     Chart Command Bars Manager

    The chart command bars manager (hereafter referred to as manager) is a component, which is represented by the NChartCommandBarsManager class. The manager contains a commander, which is accessible from its Commander property. Like the commander it also exposes a ChartControl property and naturally delegates the implementation to the contained commander. In this way the logic behind all commands is wrapped inside the commander and the chart commands.

    The manager derives from the Nevron UI NCommandBarsManager class and, as such, is responsible for populating it with Nevron UI command contexts and command ranges. The command ranges and command contexts are recreated by Recreate method. The ranges are initialized with the values of the ChartCommandRange enumeration, while the command contexts are populated with the Nevron UI representation of the chart commands. The Recreate method also rebuilds the docking toolbars.

    The docking toolbars building is performed by replaceable parts of the manager, which are responsible to create command context instances (Nevron UI commands) and that is why they are called command builders. All command builders derive from the base NChartCommandBuilder class. Currently available are the following command builders:

    • Toolbars Builder - it is represented by the NChartToolbarCommandBuilder class, an instance of which can be obtained from the ToolbarsBuilder property of the manager. You can use it to control the commands which appear in the toolbars.
     Inserting the Command Bars Manager in the form

    The NChartCommandBarsManager must be represented by the following item in the Toolbox:

    Drag and drop it in the form.

     Related Examples
    Windows forms: User Interface\Command Bars
    See Also