Define the OnClick Handler - Author-it On-Premises - Author-it

Author-it Development Documentation

Define a handler for the OnClick property of the AddArgs. This method will start the plugin.

This method may need to do some of the following:

  • Validate the selected items from Author-it

  • Display a form to the user

  • Access the Author-it library using Author-it API methods

  • Access a third-party system

C#

private void clickHandler(object sender, AuthoritEventArgs e)

{

// Access the selected objects, etc via the AuthoritEventArgs

_destinationFolderId = e.CurrentFolderId ;

// The plugin may access the library via Authorit.API methods

var libraryConfigList = new API.Configuration.LibraryConfigurationList(CreateLibraryConfig(libraryAlias, e));

var applicationContext = new API.ApplicationContext(libraryConfigList);

var authentication = applicationContext.GetServiceInstance<Of API.Services.Authentication>();

// The plugin may start its own UI

PluginForm.Show();

}

VB

Private Sub clickHandler(ByVal sender As Object, ByVal e As AuthoritEventArgs)

' Access the selected objects, etc via the AuthoritEventArgs

_destinationFolderId = e.CurrentFolderId

' The plugin may access the library via Authorit.API methods

Dim libraryConfigList As New API.Configuration.LibraryConfigurationList(CreateLibraryConfig(libraryAlias, e))

Dim applicationContext As New API.ApplicationContext(libraryConfigList)

Dim authentication As API.Services.Authentication = applicationContext.GetServiceInstance(Of API.Services.Authentication)()

' The plugin may start its own UI

PluginForm.Show()

End Sub