Kanzi  3.9.9
Kanzi Studio plugin API
Solution Interface Reference

Access the Kanzi Studio projects in a Kanzi solution. More...

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

Properties

Project ActiveProject [get, set]
 Gets or sets the currently selected project in Kanzi Studio. More...
 
Project PreviewStartupProject [get]
 Gets the project which the Preview currently shows. More...
 
Project PrimaryProject [get]
 Gets the project which the user opened in Kanzi Studio. More...
 
IEnumerable< ProjectProjects [get]
 Gets the Kanzi Studio projects in the Kanzi solution. More...
 

Detailed Description

Access the Kanzi Studio projects in a Kanzi solution.

Property Documentation

Project ActiveProject
getset

Gets or sets the currently selected project in Kanzi Studio.

Examples

To get the currently selected project in Kanzi Studio:

public void Execute(PluginCommandParameter parameter)
{
// Get the currently selected project in Kanzi Studio.
var activeProject = studio.ActiveProject;
// Print the name of the selected project to the Kanzi Studio Log window.
studio.Log(activeProject.Name);
}
Project PreviewStartupProject
get

Gets the project which the Preview currently shows.

See also
KanziStudio.PreviewStarted

Examples

To get the project that the Preview window shows:

// 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;
}
private void Studio_PreviewStarted(object sender, EventArgs e)
{
// Get the project that the Preview window shows.
var previewProject = studio.Solution.PreviewStartupProject;
// When the Preview starts, print to the Kanzi Studio Log window
// "The Preview shows:" and the name of the project that the Preview shows.
studio.Log("The Preview shows: " + previewProject.Name);
}

To set the project that the Preview window shows:

// Set the project that the Preview window shows.
public void Execute(PluginCommandParameter parameter)
{
// If the Preview is running, stop the Preview.
if (studio.Commands.CanStopPreview())
{
studio.Commands.StopPreview();
}
// Start the Preview and show the main project of the solution in the Preview.
studio.Commands.StartPreview(studio.PrimaryProject);
}
Project PrimaryProject
get

Gets the project which the user opened in Kanzi Studio.

Examples

To select the project which the user opened in Kanzi Studio:

public void Execute(PluginCommandParameter parameter)
{
// Get the project that the user opened in Kanzi Studio and select that project.
studio.Solution.ActiveProject = studio.PrimaryProject;
}
IEnumerable<Project> Projects
get

Gets the Kanzi Studio projects in the Kanzi solution.

Examples

To get all projects in a Kanzi solution:

public void Execute(PluginCommandParameter parameter)
{
// Print the name of all projects in a Kanzi solution to the Kanzi Studio Log window.
studio.Log("This Kanzi solution contains these Kanzi Studio projects:");
foreach (var project in studio.Solution.Projects)
{
studio.Log(project.Name);
}
}