-
Notifications
You must be signed in to change notification settings - Fork 1
PreferencePage Addin
ToolsHub add-ins allow you to create your own Preference pages - Options - extend the PreferencePage
. Each entry of the extension node creates a new node in the Preference window's TreeView.
Name | Type |
---|---|
ExtensionPoint Path | /ToolsHub/PreferencePage |
ExtensionNode | PreferencePageAddin |
- Id - Add-in ID.
-
IsModified - Used to notify the
OnSave
method that changes have been made. - Page - Preference page view (Windows.Form).
- Title - Display name in Preference window's TreeView
-
InitializePage() - Initializes our Preference page. Accessed via the
Page
property. - OnSave() - Save method called when, OK button is clicked on Preference window.
When creating a PreferencePage form it's recommended for you to use the IPreferencePageForm
. This helps us adhere to keeping a commonality between our add-ins and naming conventions.
- IsModified - Tells our extension node that we have modified data that needs saved.
- OnSave() - Triggered when save is called from our extension node.
The PreferencePageAddin
extension node can be used to register any PreferencePageExtension
abstract class. We have 2 methods for attaching to the preferences window, XML and Assembly code.
XML Manifest:
<Extension path="/ToolsHub/PreferencePage">
<PreferencePageAddin
type="Xeno.ToolsHub.SampleXmlAddin.PreferenceHandler" />
</Extension>
The following attribute(s) must be supplied when registering a preference page:
-
type: class that implements the page (must be
IPreferencePageExtension
).
Assembly Code:
using Xeno.ToolsHub.ExtensionModel;
using Xeno.ToolsHub.ExtensionModel.Preferences;
namespace Xeno.Test
{
[Mono.Addins.Extension(
NodeName = ExtensionName.PreferencePageAddin,
Path = ExtensionPath.PreferencePage)]
public class PreferenceHandler : PreferencePageExtension
{
// ...
}
}
The PreferencePageExtension
required you to
In most cases, you'll probably maintain your saving inside of your view (Windows Form). Below is an example of that.
// PerferenceHandler.cs
public override void OnSave()
{
_page.OnSave();
}
// PreferencePage.cs
public bool OnSave()
{
Log.Debug("Mock save, perform actions here.");
return true;
}
- Home
- ToolsHub Architecture
- Addin ExtensionPoints
- Creating an Add-in
- Design Docs
- Feature Requests
- FAQ