public void AddFinalNode(string name)
        {
            if (string.IsNullOrEmpty(name))
            {
                throw new Exception();
            }

            if (DiagramElements == null)
            {
                throw new ActivityDiagramRuleException();
            }

            if (!AcceptDuplicate)
            {
                if (GetDiagramElement(name, ActivityDiagramElements.ElementTypes.FinalNode) != null)
                {
                    throw new Exception();
                }
            }

            DiagramElements.Add(new KeyValuePair <string, ActivityDiagramElements>(name,
                                                                                   new FinalNode
            {
                Name = name
            })
                                );
        }
示例#2
0
文件: Diagram.cs 项目: mff-uk/xcase
 /// <summary>
 /// Checks, whether <paramref name="element"/> is present in the diagram.
 /// </summary>
 /// <param name="element">model element</param>
 /// <returns><code>true</code> if element is present in the diagram, <code>false</code> otherwise</returns>
 /// <seealso cref="DiagramElements"/>
 public bool IsElementPresent(Element element)
 {
     return(DiagramElements.ContainsKey(element));
 }