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