Add a Context Menu Item to the Object List Context Menu - Cloud - Author-it

Development Documentation

Use the ContextMenuAddArgs class to add a menu item to the object list context menu. The screen shot below shows a context menu item named Hello Plugin added to the context menu for the object list.

Note: Adding a context menu item to the book editor tree also adds the context menu item to the object list.

The code below is shows an example of adding the context menu item plug-in shown above.

public class PluginManager : IPlugin

{

private AitApplicationProxy proxy; //Create a class-scoped field for the proxy

public PluginManager(AitApplicationProxy applicationProxy)

{

ContextMenuAddArgs helloContextItem = new ContextMenuAddArgs(); //Initialize a new instance of the ContextMenuAddArgs class

helloContextItem.IconImage = Properties.Resources.debug_add_16; //Set the image to a resource in the assembly

helloContextItem.OnClick = helloContextItem_OnClick; //Set the OnClick event handler

helloContextItem.PluginName = "Hello Plugin"; //Set the unique name (and display name) for the context item

proxy.AddPluginToObjectContextMenu(helloContextItem); //Use the proxy to add the context menu item

}

private void helloContextItem_OnClick(Object sender, AuthoritEventArgs e)

{

//Plug-in code goes here

}

}