Kanzi 4.1.0
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

void BeginEmphasize (EmphasizeFlag target)
 Starts emphasizing an ongoing operation.
 
bool CanExecutePluginCommand (PluginCommand command, IEnumerable< ProjectItem > items)
 Checks whether a plugin command can be executed on the specified project items.
 
bool CanExecutePluginCommand (string commandName, IEnumerable< ProjectItem > items)
 Checks whether a plugin command can be executed on the specified project items.
 
void ExecutePluginCommand (PluginCommand command, IEnumerable< ProjectItem > items)
 Executes a plugin command on the specified project items.
 
void ExecutePluginCommand (string commandName, IEnumerable< ProjectItem > items)
 Executes a plugin command on the specified project items.
 
void FinishEmphasize (EmphasizeFlag type)
 Ends emphasizing an ongoing operation and allows Kanzi Studio to return to the normal state.
 
DateTimeGetExpirationDateForLicensedFeature (string featureId)
 Gets the expiration date of the license of an optional feature.
 
string GetFolderPathFromUser (string dialogTitle, string initialDirectory, string userPreferencesSetting)
 Prompts the user to provide a path to a directory.
 
string GetFolderPathFromUser (string dialogTitle, string initialPath)
 Opens a folder browser dialog and returns the selected folder path.
 
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.
 
byte[] GetPreviewScreenshot (bool useBackground)
 Captures the current Kanzi Studio Preview frame as a PNG-encoded byte array.
 
string GetUserInput (string title, string prompt)
 Creates a dialog box which prompts the user to provide input.
 
string GetUserInput (string title, string prompt, IEnumerable< string > options, string initialValue)
 Displays a dialog box which prompts the user to select a value from one of the predefined options using a drop-down menu.
 
MessageBoxResult GetUserInput (string title, string prompt, MessageBoxButton messageBoxButton)
 Displays a message box with the specified buttons and returns the user's response.
 
string GetUserInput (string title, string prompt, MessageBoxButton messageBoxButton, string extraOptionText)
 Displays a message box with the specified buttons and an extra option, and returns the user's response.
 
string GetUserInput (string title, string prompt, string initialValue)
 Creates a dialog box which prompts the user to provide input.
 
void Log (string message)
 Writes to the Kanzi Studio Log window.
 
void Log (string message, Exception exception)
 Writes information about an exception to the Kanzi Studio Log window.
 
void Log (string message, LogLevel logLevel)
 Writes to the Kanzi Studio Log window.
 
void Redo ()
 Redoes the last undone action in Kanzi Studio.
 
bool RegisterPropertyRouter (PropertyRouter router)
 Registers a property router.
 
void SendPreviewCommand (string name, object[] args)
 Sends commands to the Kanzi Studio Preview.
 
void ShowMessageBox (string text, bool isModal)
 Creates a window with a message.
 
void ShowMessageBox (string text, string caption, bool isModal)
 Displays a window with a title and a message.
 
void SubscribeToPropertyValueChanges (string projectItemPath, string propertyName)
 Tracks property changes in the Kanzi Studio Preview for the project item you set in this function.
 
void Undo ()
 Undoes the last action in Kanzi Studio.
 
bool UnregisterPropertyRouter (PropertyRouter router)
 Unregisters a property router.
 
void UnsubscribeFromPropertyValueChanges (string projectItemPath, string propertyName)
 Stops tracking the property changes in the Kanzi Studio Preview for the project item you set in this function.
 

Properties

Project ActiveProject [get]
 Gets the currently active project in Kanzi Studio.
 
string AssetToolkitPath [get]
 Provides access to the Asset Toolkit folder.
 
IEnumerable< ProjectItemClipboardItems [get]
 Gets the items currently in the clipboard.
 
Commands Commands [get]
 Gets the commands available in Kanzi Studio.
 
string FactoryContentPath [get]
 Provides access to the Factory Content folder.
 
string KanziEnvironmentVariablesBatPath [get]
 Gets the path to the Kanzi environment variables batch file.
 
DirectoryInfo KanziExecutableDirectory [get]
 Gets the path to the directory that contains the Kanzi Studio executable.
 
string KanziHome [get]
 Gets the path to the Kanzi home directory.
 
DirectoryInfo KanziWorkspaceDirectory [get]
 Gets the path to the Kanzi workspace directory.
 
IPackageUriAccessor PackageUriAccessor [get]
 Gets access to the package URI accessor for resolving package URIs.
 
string Prefab3DCompositionRootName [get]
 If the Prefab composition root is a 3D node, Preview patching makes the root node point to "&lt;Isolation Preview Viewport&gt;/&lt;Isolation Preview Scene Placeholder&gt;/&lt;Isolation preview model placeholder&gt;".
 
Project PrimaryProject [get]
 Gets the primary project in the Kanzi solution.
 
Project Project [get]
 Gets the currently active project in Kanzi Studio.
 
string ProjectTemplatesPath [get]
 Gets the path to the project Templates folder.
 
IEnumerable< ProjectItemSelectedItems [get]
 Gets the currently selected items in Kanzi Studio.
 
Solution Solution [get]
 Gets the Kanzi solution that contains all projects.
 
string StatusBarText [get, set]
 Gets or sets the text shown in the Kanzi Studio status bar.
 
IUserPreferences UserPreferences [get]
 Provides access to Kanzi Studio user preferences.
 
IGenericUtilities Utilities [get]
 Gets access to generic utility functions.
 
Version Version [get]
 Gets the version of Kanzi Studio where you run the plugin.
 

Events

EventHandler< ProjectEventArgsBinaryExported
 Occurs after Kanzi Studio exports the kzb file of the project.
 
EventHandler PreviewExited
 Occurs when the Kanzi Studio Preview closes.
 
EventHandler< PreviewPropertyChangedEventArgsPreviewPropertyChanged
 Occurs when a property value changes in the Kanzi Studio Preview.
 
EventHandler PreviewStarted
 Occurs when the Kanzi Studio Preview starts.
 
EventHandler< PreviewStartingEventArgsPreviewStarting
 Occurs when the Kanzi Studio Preview is starting.
 
EventHandler< ProjectPathEventArgsProjectClosed
 Occurs when the project is closed.
 
EventHandler< ProjectEventArgsProjectOpened
 Occurs when the project is opened.
 
EventHandler< ProjectSavingEventArgsProjectSaved
 Occurs when the project is saved.
 
EventHandler SelectionChanged
 Occurs when the selection of a node or a resource in Kanzi Studio changes.
 
EventHandler< ProjectPathEventArgsSolutionClosed
 Occurs when the primary project is closed.
 
EventHandler< ProjectEventArgsSolutionOpened
 Occurs when a new primary project is created or loaded.
 
EventHandler< StatusEventArgsStatusChanged
 Occurs when the Kanzi Studio status changes.
 

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

◆ BeginEmphasize()

void BeginEmphasize ( EmphasizeFlag target)

Starts emphasizing an ongoing operation.

Parameters
targetTarget location, for example a preview window.
See also
FinishEmphasize

◆ CanExecutePluginCommand() [1/2]

bool CanExecutePluginCommand ( PluginCommand command,
IEnumerable< ProjectItem > items )

Checks whether a plugin command can be executed on the specified project items.

Parameters
commandThe plugin command to check.
itemsThe project items on which to check if the command can be executed.
Returns
True if the command can be executed, otherwise false.
See also
ExecutePluginCommand(PluginCommand, IEnumerable<ProjectItem>)

◆ CanExecutePluginCommand() [2/2]

bool CanExecutePluginCommand ( string commandName,
IEnumerable< ProjectItem > items )

Checks whether a plugin command can be executed on the specified project items.

Parameters
commandNameThe name of the plugin command to check.
itemsThe project items on which to check if the command can be executed.
Returns
True if the command can be executed, otherwise false.
See also
ExecutePluginCommand(string, IEnumerable<ProjectItem>)

◆ ExecutePluginCommand() [1/2]

void ExecutePluginCommand ( PluginCommand command,
IEnumerable< ProjectItem > items )

Executes a plugin command on the specified project items.

Parameters
commandThe plugin command to execute.
itemsThe project items on which to execute the command.
See also
CanExecutePluginCommand(PluginCommand, IEnumerable<ProjectItem>)

◆ ExecutePluginCommand() [2/2]

void ExecutePluginCommand ( string commandName,
IEnumerable< ProjectItem > items )

Executes a plugin command on the specified project items.

Parameters
commandNameThe name of the plugin command to execute.
itemsThe project items on which to execute the command.
See also
CanExecutePluginCommand(string, IEnumerable<ProjectItem>)

◆ FinishEmphasize()

void FinishEmphasize ( EmphasizeFlag type)

Ends emphasizing an ongoing operation and allows Kanzi Studio to return to the normal state.

Parameters
typeTarget location, for example a preview window.
See also
BeginEmphasize

◆ 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() [1/2]

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.

◆ GetFolderPathFromUser() [2/2]

string GetFolderPathFromUser ( string dialogTitle,
string initialPath )

Opens a folder browser dialog and returns the selected folder path.

Parameters
dialogTitleThe title of the folder browser dialog.
initialPathThe initial path to display in the dialog.
Returns
The selected folder path, or null if the user cancels the operation.
See also
GetFolderPathFromUser(string, string, string)

◆ 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",
true);
}

◆ GetPreviewScreenshot()

byte[] GetPreviewScreenshot ( bool useBackground)

Captures the current Kanzi Studio Preview frame as a PNG-encoded byte array.

Parameters
useBackgroundIf true, the screenshot includes the screen background color; if false, the background is transparent.
Returns
PNG bytes, or null if the Preview is not currently running or the capture failed.

◆ GetUserInput() [1/5]

string GetUserInput ( string title,
string prompt )

Creates a dialog box which prompts the user to provide input.

For example, you can use this function to get the path of a node where you want your plugin to start executing its commands.

Parameters
titleThe title of the dialog box.
promptThe message you want to show in the dialog box.
Returns
The user input. If user cancels the operation, the function returns null.

Examples

To create a dialog box with a title and prompt:

public void Execute(PluginCommandParameter parameter)
{
// Display a dialog box with:
// - Title "Where do you want to create the node?"
// - Prompt message "Enter the path where you want to create the node"
studio.GetUserInput(
"Where do you want to create the node?",
"Enter the path where you want to create the node");
}

◆ GetUserInput() [2/5]

string GetUserInput ( string title,
string prompt,
IEnumerable< string > options,
string initialValue )

Displays a dialog box which prompts the user to select a value from one of the predefined options using a drop-down menu.

Parameters
titleThe title of the dialog box.
promptThe message you want to show in the dialog box.
optionsThe options shown in a drop-down box from which the user can select.
initialValueThe value preselected in the drop-down menu.
Returns
The user input. If user cancels the operation, the function returns null.

◆ GetUserInput() [3/5]

MessageBoxResult GetUserInput ( string title,
string prompt,
MessageBoxButton messageBoxButton )

Displays a message box with the specified buttons and returns the user's response.

Parameters
titleThe title of the message box.
promptThe message to display in the message box.
messageBoxButtonThe buttons to display in the message box.
Returns
The result indicating which button the user clicked.

◆ GetUserInput() [4/5]

string GetUserInput ( string title,
string prompt,
MessageBoxButton messageBoxButton,
string extraOptionText )

Displays a message box with the specified buttons and an extra option, and returns the user's response.

Parameters
titleThe title of the message box.
promptThe message to display in the message box.
messageBoxButtonThe buttons to display in the message box.
extraOptionTextThe text for an additional option button.
Returns
The user's response as a string.

◆ GetUserInput() [5/5]

string GetUserInput ( string title,
string prompt,
string initialValue )

Creates a dialog box which prompts the user to provide input.

For example, you can use this function to get the path of a node where you want your plugin to start executing its commands.

Parameters
titleThe title of the dialog box.
promptThe message you want to show in the dialog box.
initialValueThe predefined value entered in the prompt.
Returns
The user input. If user cancels the operation, the function returns null.
See also
GetPathFromUser

Examples

To create a dialog box with a title, a prompt, and a text box with a predefined value:

public void Execute(PluginCommandParameter parameter)
{
// Display a dialog box with:
// - Title "Where do you want to create the node?"
// - Prompt message "Enter the path where you want to create the node"
// - Text box with a predefined value set to "Screen/Screens/RootNode"
studio.GetUserInput(
"Where do you want to create the node?",
"Enter the path where you want to create the node",
"Screen/Screens/RootNode");
}

◆ Log() [1/3]

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!");
}

◆ Log() [2/3]

void Log ( string message,
Exception exception )

Writes information about an exception to the Kanzi Studio Log window.

Parameters
messageThe message you want to print to the Log window before the exception information.
exceptionThe exception to be logged.

◆ Log() [3/3]

void Log ( string message,
LogLevel logLevel )

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.
logLevelThe level of the message you want to print to the Log window.

Examples

To print a message to the Log window as a regular notification:

public void Execute(PluginCommandParameter parameter)
{
// Print "Hello world!" to the Kanzi Studio Log window.
studio.Log("Hello world!", LogLevel.INFO);
}

To print a message to the Log window as a warning:

public void Execute(PluginCommandParameter parameter)
{
// Print "Warning!" with a yellow background to the Kanzi Studio Log window.
studio.Log("Warning!", LogLevel.WARNING);
}

◆ Redo()

void Redo ( )

Redoes the last undone action in Kanzi Studio.

See also
Undo

◆ RegisterPropertyRouter()

bool RegisterPropertyRouter ( PropertyRouter router)

Registers a property router.

A property router can interfere when a user edits properties in Kanzi Studio.

Parameters
routerThe router to register.
Returns
True, if router was registered. False, if the router is already registered.
See also
UnregisterPropertyRouter

◆ SendPreviewCommand()

void SendPreviewCommand ( string name,
object[] args )

Sends commands to the Kanzi Studio Preview.

Parameters
nameThe name of the command you want to send to the Preview.
argsThe command arguments you want to send (must be serializable.)

◆ ShowMessageBox() [1/2]

void ShowMessageBox ( string text,
bool isModal )

Creates a window with a message.

For example, you can use this function to show a message to the user.

Parameters
textThe message you want to show in the window.
isModalWhether the window is modal. When set to true you cannot use the main Kanzi Studio window until you confirm the message in this window.

Examples

To create a modal window which displays a message:

public void Execute(PluginCommandParameter parameter)
{
// Display a modal window with the message "All nodes created".
// The second parameter sets whether the window is modal.
studio.ShowMessageBox("All nodes created.", true);
}

◆ ShowMessageBox() [2/2]

void ShowMessageBox ( string text,
string caption,
bool isModal )

Displays a window with a title and a message.

For example, you can use this function to show a message to the user.

Parameters
textThe message you want to show in the window.
captionThe title of the window.
isModalWhether the window is modal. When set to true you cannot use the main Kanzi Studio window until you confirm the message in this window.

Examples

To create a modal window with a title and which displays a message:

public void Execute(PluginCommandParameter parameter)
{
// Display a modal window with the title "Success!" and the message "All nodes created".
// The third parameter sets whether the window is modal.
studio.ShowMessageBox("All nodes created.", "Success!", true);
}

◆ SubscribeToPropertyValueChanges()

void SubscribeToPropertyValueChanges ( string projectItemPath,
string propertyName )

Tracks property changes in the Kanzi Studio Preview for the project item you set in this function.

Triggers change events in project item and in this class.

Parameters
projectItemPathThe path to the project item for which you want to track property changes.
propertyNameThe name of the property the changes of which you want to track.
See also
UnsubscribeFromPropertyValueChanges

◆ Undo()

void Undo ( )

Undoes the last action in Kanzi Studio.

See also
Redo

◆ UnregisterPropertyRouter()

bool UnregisterPropertyRouter ( PropertyRouter router)

Unregisters a property router.

A property router can interfere when a user edits properties in Kanzi Studio.

Parameters
routerThe router to unregister.
Returns
True, if the router was successfully unregistered. False, if no such router was registered.
See also
RegisterPropertyRouter

◆ UnsubscribeFromPropertyValueChanges()

void UnsubscribeFromPropertyValueChanges ( string projectItemPath,
string propertyName )

Stops tracking the property changes in the Kanzi Studio Preview for the project item you set in this function.

Parameters
projectItemPathThe path to the project item for which you want to stop tracking property changes.
propertyNameThe name of the property the changes of which you want to stop tracking.
See also
SubscribeToPropertyValueChanges

Property Documentation

◆ ActiveProject

Project ActiveProject
get

Gets the currently active project in Kanzi Studio.

See also
PrimaryProject, Solution

◆ AssetToolkitPath

string AssetToolkitPath
get

Provides access to the Asset Toolkit folder.

◆ ClipboardItems

IEnumerable<ProjectItem> ClipboardItems
get

Gets the items currently in the clipboard.

◆ Commands

Gets the commands available in Kanzi Studio.

◆ FactoryContentPath

string FactoryContentPath
get

Provides access to the Factory Content folder.

◆ KanziEnvironmentVariablesBatPath

string KanziEnvironmentVariablesBatPath
get

Gets the path to the Kanzi environment variables batch file.

◆ KanziExecutableDirectory

DirectoryInfo KanziExecutableDirectory
get

Gets the path to the directory that contains the Kanzi Studio executable.

See also
KanziHome, KanziWorkspaceDirectory

◆ KanziHome

string KanziHome
get

Gets the path to the Kanzi home directory.

See also
KanziWorkspaceDirectory, KanziExecutableDirectory

◆ KanziWorkspaceDirectory

DirectoryInfo KanziWorkspaceDirectory
get

Gets the path to the Kanzi workspace directory.

See also
KanziHome, KanziExecutableDirectory

◆ PackageUriAccessor

IPackageUriAccessor PackageUriAccessor
get

Gets access to the package URI accessor for resolving package URIs.

◆ Prefab3DCompositionRootName

string Prefab3DCompositionRootName
get

If the Prefab composition root is a 3D node, Preview patching makes the root node point to "&lt;Isolation Preview Viewport&gt;/&lt;Isolation Preview Scene Placeholder&gt;/&lt;Isolation preview model placeholder&gt;".

This member returns the new name of the composition root node.

The new name of the composition root node when composing Prefab of a 3D node.

◆ PrimaryProject

Project PrimaryProject
get

Gets the primary project in the Kanzi solution.

The primary project is the project that the user opened in Kanzi Studio.

See also
ActiveProject, Solution

◆ Project

Gets the currently active project in Kanzi Studio.

This property is obsolete. Use PrimaryProject to get the root of the project hierarchy, or ActiveProject to get the project that is currently active in the UI.

See also
PrimaryProject, ActiveProject

◆ ProjectTemplatesPath

string ProjectTemplatesPath
get

Gets the path to the project Templates folder.

Resolved the same way as the New Project dialog — honors source-control mode (uses the repo's Templates) and falls back to the workspace Templates folder otherwise. Use this for any feature that copies template files (e.g. CodeBehind generation) so it tracks the same template root as the application templates.

◆ SelectedItems

IEnumerable<ProjectItem> SelectedItems
get

Gets the currently selected items in Kanzi Studio.

See also
SelectionChanged

◆ Solution

Gets the Kanzi solution that contains all projects.

◆ StatusBarText

string StatusBarText
getset

Gets or sets the text shown in the Kanzi Studio status bar.

◆ UserPreferences

IUserPreferences UserPreferences
get

Provides access to Kanzi Studio user preferences.

Use this to store settings that are not project dependent.

◆ Utilities

IGenericUtilities Utilities
get

Gets access to generic utility functions.

◆ Version

Version Version
get

Gets the version of Kanzi Studio where you run the plugin.

The version of Kanzi Studio.

Examples

To get the major, minor, revision, and build numbers of the Kanzi Studio where you run the plugin:

public void Execute(PluginCommandParameter parameter)
{
// Print the Kanzi Studio version in the format Major.Minor.Revision.Build
// to the Kanzi Studio Log window.
studio.Log(
studio.Version.Major + "." +
studio.Version.Minor + "." +
studio.Version.Revision + "." +
studio.Version.Build);
}

Event Documentation

◆ BinaryExported

EventHandler<ProjectEventArgs> BinaryExported

Occurs after Kanzi Studio exports the kzb file of the project.

Examples

To subscribe to the BinaryExported event:

// Create the event handler and subscribe to the BinaryExported event to get
// notified when Kanzi Studio finishes exporting the kzb file of the project.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when Kanzi Studio finishes
// exporting the kzb file of the project.
studio.BinaryExported += Studio_BinaryExported;
}
{
// When Kanzi Studio finishes exporting the kzb file of the project,
// print a message to the Kanzi Studio Log window.
studio.Log("Finished exporting the kzb file of the project \"" + e.Project.Name + "\".");
}

◆ PreviewExited

EventHandler PreviewExited

Occurs when the Kanzi Studio Preview closes.

See also
PreviewStarted

Examples

To subscribe to the PreviewExited event:

// Create the event handler and subscribe to the PreviewExited event to get notified
// when the Kanzi Studio Preview closes.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when the Preview closes.
studio.PreviewExited += Studio_PreviewExited;
}
private void Studio_PreviewExited(object sender, EventArgs e)
{
// When the Preview closes, print a message to the Kanzi Studio Log window.
studio.Log("The Preview closed.");
}

◆ PreviewPropertyChanged

Occurs when a property value changes in the Kanzi Studio Preview.

See also
SubscribeToPropertyValueChanges, UnsubscribeFromPropertyValueChanges

◆ PreviewStarted

EventHandler PreviewStarted

Occurs when the Kanzi Studio Preview starts.

See also
PreviewExited

Examples

To subscribe to the PreviewStarted event:

// Create the event handler and subscribe to the PreviewStarted event to get notified
// when the Kanzi Studio Preview starts.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when the Preview starts.
studio.PreviewStarted += Studio_PreviewStarted;
studio.Log("PreviewStarted subscribed.");
}
private void Studio_PreviewStarted(object sender, EventArgs e)
{
// When the Preview starts, print a message to the Kanzi Studio Log window.
studio.Log("The Preview started.");
}

◆ PreviewStarting

Occurs when the Kanzi Studio Preview is starting.

You can cancel this event.

See also
PreviewStarted

Examples

To subscribe to the PreviewStarting event:

// Create the event handler and subscribe to the PreviewStarting event to get notified
// when the Kanzi Studio Preview is starting.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when the Preview is starting.
studio.PreviewStarting += Studio_PreviewStarting;
studio.Log("PreviewStarting subscribed.");
}
{
// When the Preview is starting, cancel it.
e.Cancel("Preview startup canceled by an example for demonstration purposes.");
}

◆ ProjectClosed

Occurs when the project is closed.

See also
ProjectOpened, ProjectSaved

Examples

To subscribe to the ProjectClosed event:

// Create the event handler and subscribe to the ProjectClosed event to get notified when a project is closed.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when a project is closed.
studio.ProjectClosed += Studio_ProjectClosed;
}
{
// When the project is closed, show a dialog box with a message about project closing.
studio.ShowMessageBox("The project \"" + e.ProjectPath + "\" is closed.", false);
}

◆ ProjectOpened

Occurs when the project is opened.

This can happen when the primary project of a solution is loaded / created or when a subproject is loaded or created.

See also
ProjectClosed, ProjectSaved

Examples

To subscribe to the ProjectOpened event:

// Create the event handler and subscribe to the ProjectOpened event to get notified when a project is opened.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when a project is opened.
studio.ProjectOpened += Studio_ProjectOpened;
}
private void Studio_ProjectOpened(object sender, EventArgs e)
{
// When the project is opened, show a dialog box with the message "The project is opened."
studio.Log("The project is opened.");
}

◆ ProjectSaved

Occurs when the project is saved.

See also
ProjectOpened, ProjectClosed

Examples

To subscribe to the ProjectSaved event:

// Create the event handler and subscribe to the ProjectSaved event to get notified when a project is saved.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when a project is saved.
studio.ProjectSaved += Studio_ProjectSaved;
}
{
// When the project is saved, print a message to the Kanzi Studio Log window.
studio.Log("The project \"" + e.Project.Name + "\" is saved.");
}

◆ SelectionChanged

EventHandler SelectionChanged

Occurs when the selection of a node or a resource in Kanzi Studio changes.

For example, Kanzi Studio sets off this event when you select a node in a Project or Nodes windows, when you select a library, a directory, or a resource in the Library, or any of the resource windows.

Examples

To subscribe to the SelectionChanged event:

// Create the event handler and subscribe to the SelectionChanged event to get notified
// when the selection of a node or a resource in Kanzi Studio changes.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when the selection of a node or a resource
// in Kanzi Studio changes.
studio.SelectionChanged += Studio_SelectionChanged;
}
private void Studio_SelectionChanged(object sender, EventArgs e)
{
// When the selection of a node or a resource in Kanzi Studio changes,
// print a message to the Kanzi Studio Log window.
studio.Log("The node or resource selection changed.");
}

◆ SolutionClosed

Occurs when the primary project is closed.

Examples

To subscribe to the SolutionClosed event:

// Create the event handler and subscribe to the SolutionClosed event to get notified when a Kanzi solution is closed.
public void Execute(PluginCommandParameter parameter)
{
// Create the event handler that is set off when a project is closed.
studio.SolutionClosed += Studio_SolutionClosed;
}
private void Studio_SolutionClosed(object sender, EventArgs e)
{
// When the solution is closed, show a dialog box with the message "The solution is closed."
studio.ShowMessageBox("The solution is closed.", false);
}

◆ SolutionOpened

EventHandler<ProjectEventArgs> SolutionOpened

Occurs when a new primary project is created or loaded.

◆ StatusChanged

EventHandler<StatusEventArgs> StatusChanged

Occurs when the Kanzi Studio status changes.