当前位置: 首页>>代码示例>>C#>>正文


C# Diagram.setName方法代码示例

本文整理汇总了C#中Diagram.setName方法的典型用法代码示例。如果您正苦于以下问题:C# Diagram.setName方法的具体用法?C# Diagram.setName怎么用?C# Diagram.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Diagram的用法示例。


在下文中一共展示了Diagram.setName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

  public static void Main(String[] Args) {
    Diagram diagram = new Diagram();

    diagram.setName( "myDiagram" );
    diagram.makeDynamic();
    // diagram.makeStatic();

    Interface interface1 = new Interface();
    interface1.setName( "myInterface" );
    interface1.setPosition( 51, 26 );
    
    Operation operation1 = new Operation();
    operation1.setName( "myOperation" );
    operation1.setReturnType( "String" );
    operation1.setVisibility( "public" );
    
    interface1.add( operation1 );

    Class class1 = new Class();
    class1.setName( "myClass" );
    class1.addStereotype( "someStereotype" );
    class1.implement( interface1 );
    class1.setPosition( 194, 106 );
    
    TSF.UmlCanvas.Attribute attribute1 = new TSF.UmlCanvas.Attribute();
    attribute1.setName( "attribute1" );
    attribute1.setType( "String" );
    attribute1.setVisibility( "public" );

    class1.add( attribute1 );

    Class class2 = new Class();
    class2.setName( "myOtherClass" );
    class2.inheritFrom( class1 );
    class2.setPosition( 58, 206 );
    class2.makeAbstract();

    TSF.UmlCanvas.Attribute attribute2 = new TSF.UmlCanvas.Attribute();
    attribute2.setName( "attribute2" );
    attribute2.setType( class1 );
    attribute2.addStereotype( "stereotyped" );
    attribute2.setVisibility( "protected" );
    attribute2.makeStatic();
    
    class2.add( attribute2 );

    Operation operation2 = new Operation();
    operation2.setName( "myOtherOperation" );
    operation2.add( new Argument( "arg1", "argType" ) );
    operation2.add( new Argument( "arg2", interface1 ) );
    operation2.addStereotype( "alsoStereotyped" );
    operation2.makeAbstract();
    
    class2.add( operation2 );

    Enumeration enumeration1 = new Enumeration();
    enumeration1.setName( "myEnumeration" );
    enumeration1.setPosition( 354, 115 );

    diagram.add( interface1 );
    diagram.add( enumeration1 );
    diagram.add( class1 );
    diagram.add( class2 );
    
    Association association1 = new Association();
    association1.setName( "myAssociation" );
    Role role1 = new Role( interface1 );
    role1.makeNavigable();
    association1.add( role1 );
    Role role2 = new Role( class2, "roleName" );
    role2.makeComposite();
    association1.add( role2 );
    
    diagram.add( association1 );
    
    Dependency dependency1 = new Dependency();
    dependency1.setClient( class1 );
    dependency1.setSupplier( enumeration1, "usingThis" );
    
    diagram.add( dependency1 );
    
    Note note1 = new Note();
    note1.setText( "We do notes too ;-)" );
    note1.linkTo( class2 );
    note1.setPosition( 341, 233 );
    
    diagram.add( note1 );

    Console.WriteLine( diagram );
  }
开发者ID:ceena,项目名称:UmlCanvas,代码行数:90,代码来源:test.cs


注:本文中的Diagram.setName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。