This interface lets you set preferences for all Output or Plug-in interfaces implemented.
| Function | Description |
IPluginPreferences |
This function is called when a user selects the preferences button found by navigating to the Tools menu > Options. When the HotDocs Options dialog opens select the Plugins folder and navigate to the plugin you want to edit on the Plugins list. |
The following Visual C# example implements the IPluginPreferences interface calling a method that opens a new form allowing the user to set preferences for the plugin. The example shown is used in conjunction with the IOutputPlugin interface :
//IPluginPreferences: Calls custom method.
public void Edit(IntPtr parentWindowHandle)
{
createFolderPath();
}
//Opens dialog form allowing user to set preferences.
public void createFolderPath()
{
dlgChooseFolder dlg = new dlgChooseFolder();
dlg.Show();
_dlgfolderPath = dlg.folderPath;
}
//**Code for the custom dlgChooseFolder form **
public partial class dlgChooseFolder : Form
{
string OutFolder = "OutputFolder";
public dlgChooseFolder()
{
InitializeComponent();
RegistryKey getKey = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(OutFolder, true);
if (getKey != null)
{
string pathName = (string)getKey.GetValue(OutFolder);
lblPath.Text = pathName;
}
}
private void btnChooseFolder_Click(object sender, EventArgs e)
{
FolderBrowserDialog fldPath = new FolderBrowserDialog();
fldPath.SelectedPath = lblPath.Text; fldPath.ShowNewFolderButton = true;
if (fldPath.ShowDialog() == DialogResult.OK)
{
lblPath.Text = fldPath.SelectedPath;
RegistryKey key;
key = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(OutFolder);
key.SetValue(OutFolder, fldPath.SelectedPath);
key.Close();
}
else
{
MessageBox.Show("Operation canceled");
}
}
public string folderPath
{
get
{
return lblPath.Text;
}
set
{
lblPath.Text = value;
}
}
private void btnSave_Click(object sender, EventArgs e)
{
this.Close();
}
}