问题描述
我尝试像这样更改现有的SD
I try to change existing SD like this
using (IModelingProjectReader projectReader = ModelingProject.LoadReadOnly(projectPath))
{
var sd = projectReader.LoadDiagram(Filename) as ISequenceDiagram;
IInteraction interaction = sd.Interaction;
var newLifeLine = interaction.CreateLifeline();
}
并获取System.InvalidOperationException-无法在锁定的父项,分区或存储中添加新的生命线."
and get System.InvalidOperationException - "Cannot add a new Lifeline within a locked parent, partition or store."
如果我尝试添加或删除一些元素,我会通过活动图得到相同的错误.我做错了什么?
The same error i get by Activity diagrams if i try to add or delete some elements. What i do wrong?
P.S.我知道这篇文章http://msdn.microsoft.com/zh-CN/library/vstudio/ee349042.aspx ,但是他们是否这样做?
P.S. I know this article http://msdn.microsoft.com/en-US/library/vstudio/ee349042.aspx, but they are doing the same, or not?
推荐答案
相反,您需要以可写状态打开模型.看中的例子如何打开UML模型.
Instead, you need to open the model in a writable state. Look at the examples inHow to Open a UML Model.
这篇关于如何以编程方式编辑序列图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!