DeactivateUIControlArgs Class - Author-it On-Premises - Author-it

Author-it Development Documentation

Provides properties that enable you to add a control deactivation plugin to Author.

Example Code

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

}

}

}