Kanzi  3.9.5
Localization API
KanziStudio Interface Reference

Get notifications about Kanzi Studio events and get access to the core Kanzi Studio operations, such as access to the Kanzi Studio project, get input from the user, and show notifications. More...

Inheritance diagram for KanziStudio:
[legend]
Collaboration diagram for KanziStudio:
[legend]

Public Member Functions

DateTime GetExpirationDateForLicensedFeature (string featureId)
 Gets the expiration date of the license of an optional feature. More...
 
string GetFolderPathFromUser (string dialogTitle, string initialDirectory, string userPreferencesSetting)
 Prompts the user to provide a path to a directory. More...
 
string GetPathFromUser (string dialogTitle, string initialDirectory, string userPreferencesSetting, string defaultExtension, string filter, PathDialogType pathDialogType, bool multiselect)
 Opens a Windows dialog that allows the user to browse their computer to select a path. More...
 
void Log (string message)
 Writes to the Kanzi Studio Log window. More...
 

Detailed Description

Get notifications about Kanzi Studio events and get access to the core Kanzi Studio operations, such as access to the Kanzi Studio project, get input from the user, and show notifications.

Member Function Documentation

◆ GetExpirationDateForLicensedFeature()

DateTime GetExpirationDateForLicensedFeature ( string  featureId)

Gets the expiration date of the license of an optional feature.

Parameters
featureIdThe feature ID of the optional feature.
Returns
One of these values:
  • Expiration date, if a license exists for the feature ID
  • DateTime.MaxValue, if the license is permanent
  • Null, if no license exists for the feature ID.

◆ GetFolderPathFromUser()

string GetFolderPathFromUser ( string  dialogTitle,
string  initialDirectory,
string  userPreferencesSetting 
)

Prompts the user to provide a path to a directory.

Parameters
dialogTitleThe title of the dialog box.
initialDirectoryInitial directory where the folder dialog is opened.
userPreferencesSettingA key to be used for storing the last selected folder in the user preferences. Set as null not to save the path. If an existing value is found from user preferences, that is used over the value supplied in initialDirectory parameter.
Returns
The select folder path or null if cancelled.

◆ GetPathFromUser()

string GetPathFromUser ( string  dialogTitle,
string  initialDirectory,
string  userPreferencesSetting,
string  defaultExtension,
string  filter,
PathDialogType  pathDialogType,
bool  multiselect 
)

Opens a Windows dialog that allows the user to browse their computer to select a path.

You can use this function to get a path to either open or save a file.

Parameters
dialogTitleThe title of the dialog box.
initialDirectoryThe initial directory where to open the dialog.
userPreferencesSettingThe user preferences key to use to store the last selected directory. Set as null not to save the path. If an existing value is found from user preferences, that is used over the value supplied in initialDirectory parameter.
defaultExtensionThe default file extension to use to open or save the file.
filterThe filter definition that sets which file extensions the dialog allows the user to select.
pathDialogTypeThe type of the dialog. Use PathDialogType.OPEN for the open file dialog and PathDialogType.SAVE for the save file dialog.
multiselectWhen opening files, sets whether the user is allowed to select multiple files.
Returns
The absolute path to the selected file. If user cancels the operation, the function returns null.
See also
GetUserInput(string, string)

Examples

To open a Windows dialog which allows the user to browse their computer and select a path:

public void Execute(PluginCommandParameter parameter)
{
// Open the standard Windows dialog box where you can select which file on your computer you want to open.
// In the dialog box set:
// - Title to "Select the file you want to open".
// - Open the dialog in the current directory.
// - Store the path to the selected directory in the GetPathFromUser key in the Kanzi Studio user preferences.
// - Use .xml as the default extension for opening the file.
// - Allow the user to select only files with .xml and .txt extensions.
// - Create an open dialog.
// - Allow selection of multiple files in the dialog.
studio.GetPathFromUser(
"Select the file you want to open",
".",
"GetPathFromUser",
".xml",
"XML files (*.xml)|*.xml|Plain text files (*.txt)|*.txt",
PathDialogType.OPEN,
true);
}

◆ Log()

void Log ( string  message)

Writes to the Kanzi Studio Log window.

For example, you can use this function to inform the user about the plugin progress in the Log window.

Parameters
messageThe message you want to print to the Log window.

Examples

To print a message to the Kanzi Studio Log window:

public void Execute(PluginCommandParameter parameter)
{
// Print "Success!" to the Kanzi Studio Log window.
studio.Log("Success!");
}