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


C# EA.GetTreeSelectedItemType方法代码示例

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


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

示例1: EA_MenuClick

        // Called when user makes a selection in the menu.
        // This is your main exit point to the rest of your Add-in
        public void EA_MenuClick(EA.Repository Repository, string Location, string MenuName, string ItemName)
        {
            switch( ItemName )
            {
                case "&Audio Configuration":

                    String writerString;

                    writerString = "Please select an audio diagram";

                    Repository.CreateOutputTab("Audio Configuration");
                    Repository.EnsureOutputVisible("Audio Configuration");
                    Repository.ClearOutput("Audio Configuration");

                    /* works on currently selected diagram */

                    if (Repository.GetTreeSelectedItemType() == EA.ObjectType.otDiagram)
                    {
                        EA.Diagram theDiagram;

                        theDiagram = (EA.Diagram)Repository.GetTreeSelectedObject();
                        writerString = "Name = " + theDiagram.Name.ToString() + " " + theDiagram.Type.ToString() + System.Environment.NewLine;
                        Repository.WriteOutput("Audio Configuration", writerString, 0);

                        foreach (EA.DiagramObject theDiagramObject in theDiagram.DiagramObjects)
                        {
                            EA.Element theElement = Repository.GetElementByID(theDiagramObject.ElementID);

                            /* consider only instances */
                            if (theElement.ClassfierID != 0)
                            {
                                // get classifier, in our case it is sink or source classes
                                EA.Element theClassfierElement = Repository.GetElementByID(theElement.ClassfierID);

                                writerString = theElement.Name.ToString() + " " + theClassfierElement.Name.ToString();
                                //writerString = theDiagramObject.ObjectType.ToString() + System.Environment.NewLine;
                                Repository.WriteOutput("Audio Configuration", writerString, 0);

                                writerString = theElement.RunState;
                                Repository.WriteOutput("Audio Configuration", writerString, 0);

                                // parse embedded elements
                                foreach (EA.Element theEmbeddedElement in theElement.EmbeddedElements)
                                {
                                    writerString = "\t" + theEmbeddedElement.Name.ToString();
                                    Repository.WriteOutput("Audio Configuration", writerString, 0);
                                    foreach (EA.Connector theConnector in theEmbeddedElement.Connectors)
                                    {
                                        writerString = "\t\t" + theConnector.Name.ToString();
                                        Repository.WriteOutput("Audio Configuration", writerString, 0);
                                    }
                                }
                            }
                        }
                    }

                    break;
                case "&Menu2":

                    break;
                case "About...":
                    Form1 anAbout = new Form1();
                    anAbout.ShowDialog();
                    break;
            }
        }
开发者ID:razr,项目名称:ea-audio,代码行数:68,代码来源:Main.cs


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