Panel plugins added to the book editor are able to interact with the topic text, using ProofingEventArgs. Use the AddPanel and GetPanel methods on the TopicTextEditor class.
Adding the panel
A panel can be added to the Book Editor attaching a handler via the BookEditorOpenEventHandler method of the AitApplicationProxy, inside the plugin constructor.
The handler should then create the panel, and create PanelAddArgs, and call the ProofingEventArgs.TextEditor.AddPanel method.
Updating the panel
The panel can be refreshed by attaching a handler via the TopicOpenEventHandler method of the AitApplicationProxy, inside the plugin constructor.
Sample code
public PanelPluginMain(AitApplicationProxy proxy)
{
_proxy = proxy;
_proxy.BookEditorOpenEventHandler(BookEditorOpenHandler);
_proxy.TopicOpenEventHandler(TopicOpenHandler);
}
public void BookEditorOpenHandler(Object sender, ProofingEventArgs e)
{
// A new Book Editor has been opened, create a new panel and add it.
var panelBook = new PanelBrowser()
{
Name = "pnlPluginBook"
};
e.TextEditor.AddPanel(new PanelAddArgs()
{
PluginName = "Word Count",
Panel = panelBook,
Position = PanelPosition.Bottom
});
}
public void TopicOpenHandler(Object sender, ProofingEventArgs e)
{
// A new topic has been opened, fire an event in the user control
((PanelBrowser)e.TextEditor.GetPanel("Word Count")).OnTopicOpen(sender, e);
}