Get the lifeline type
To get the lifeline type, use the TypeModel
property of the ILifelineShape
object.
public void GetLifelineTypes(ICommandContext c, ICommandParams p)
{
ISequenceDiagram sequenceDiagram = c.App.Workspace.CurrentEditor as ISequenceDiagram;
if (sequenceDiagram == null) return;
//Get the lifelines
var lifelines = sequenceDiagram.Lifelines;
var no = 1;
foreach (ILifelineShape lifeline in lifelines)
{
//Get the lifeline type
IModel typeModel = lifeline.TypeModel;
var typeModelName = typeModel != null ? typeModel.Name : "None";
c.App.Output.WriteLine("sample", $"{no}th lifeline type : {typeModelName}");
no++;
}
}