Control Deactivation plugins - Author-it On-Premises - Author-it

Author-it Development Documentation

A control deactivation plugin changes the availability of user interface controls in Author. You use the DeactivateUIControlArgs class to add a control deactivation plugin to Author.

You can use control deactivation plugins to simplify the Author for users based on group membership or to remove controls that you replace with your own plugin user interface.

The code below shows an example of using the DeactivateUIAddArgs and DeactivateUIControlArgs classes to implement a plugin that disables the Create Book button on the main form in Author.

using AuthoritExtensibility;

namespace Sample_ControlDeactivationPlugin

{

public class PluginManager : IPlugin

{

private AitApplicationProxy proxy;

public PluginManager(AitApplicationProxy hostProxy)

{

proxy = hostProxy; //Set the local proxy to the proxy passed by the host

DeactivateUIAddArgs disableArgs = new DeactivateUIAddArgs(); //Initiatilize the plugin arguments

disableArgs.OnClick = disableArgs_OnClick; //Set the launch point for the plugin

disableArgs.PluginName = "Deactivation Plugin"; //Set the name for the plugin

proxy.AddPluginToDeactivateUI(disableArgs); //Add the plugin to the host

}

public void disableArgs_OnClick(object sender, AuthoritEventArgs args)

{

DeactivateUIControlArgs controlArgs = new DeactivateUIControlArgs(); //Initialize the control deactivation arguments

controlArgs.ControlName = "CreateBook"; //Set the name of the control to deactivate

controlArgs.ControlType = UIControlType.RibbonButton; //Set the type of the control

controlArgs.DeactivationType = DeactivationType.Disabled; //Set the deactivation type

controlArgs.ParentForm = TargetForm.MainForm; //Set the form for the control

proxy.UIControlDeactivate(controlArgs); //Add the deactivation arguments to the host

}

}

}