Write text to the output
To write text to the output tab of the info pane, use the WriteLine
method of the IOutput
object.
public void WriteLine(ICommandContext c, ICommandParams p)
{
//Write to the output and activate the output tab in the info pane
//The first argument is the category, the second argument is the output text
c.App.Output.WriteLine("sample", "message here");
//Activate the output tab
c.App.Window.IsInformationPaneVisible = true; //Show the information pane
c.App.Window.ActiveInfoWindow = "Output"; //Activate the output tab
c.App.Window.CurrentOutputCategory = "sample"; //Select a category
}
To specify the format for output, use the WriteFormatLine
method.
public void WriteFormatLine(ICommandContext c, ICommandParams p)
{
var model = c.App.Workspace.CurrentModel;
//The first argument is the category, the second argument is the format of the output text, and the third argument is the format parameters.
c.App.Output.WriteFormatLine("sample", "Current model Model name: {0} Metaclass: {1}", new []{model.Name, model.Metaclass.DisplayName});
}