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


C# DisplayMode.Equals方法代码示例

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


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

示例1: LocateOperationFromBehavior

 static void LocateOperationFromBehavior(Repository repository, Element el, DisplayMode showBehavior)
 {
     Method method = Util.GetOperationFromBrehavior(repository, el);
     if (method != null)
     {
         if (showBehavior.Equals(DisplayMode.Behavior))
         {
             Appl.DisplayBehaviorForOperation(repository, method);
         }
         else
         {
             repository.ShowInProjectView(method);
         }
     }
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:15,代码来源:EaServices.cs

示例2: DisplayOperationForSelectedElement

        // display behavior or definition for selected element
        // enum displayMode: "Behavior" or "Method"
        public static void DisplayOperationForSelectedElement(Repository repository, DisplayMode showBehavior)
        {
            ObjectType oType = repository.GetContextItemType();
            // Method found
            if (oType.Equals(ObjectType.otMethod))
            {
                // display behavior for method
                Appl.DisplayBehaviorForOperation(repository, (Method) repository.GetContextObject());
            }
            if (oType.Equals(ObjectType.otDiagram))
            {
                // find parent element
                var dia = (Diagram) repository.GetContextObject();
                if (dia.ParentID > 0)
                {
                    // find parent element
                    Element parentEl = repository.GetElementByID(dia.ParentID);
                    //
                    LocateOperationFromBehavior(repository, parentEl, showBehavior);
                }
                else
                {
                    // open diagram
                    repository.OpenDiagram(dia.DiagramID);
                }
            }


            // Connector / Message found
            if (oType.Equals(ObjectType.otConnector))
            {
                var con = (Connector) repository.GetContextObject();
                SelectBehaviorFromConnector(repository, con, showBehavior);
            }

            // Element
            if (oType.Equals(ObjectType.otElement))
            {
                var el = (Element) repository.GetContextObject();
                // locate text or frame
                if (LocateTextOrFrame(repository, el)) return;

                if (el.Type.Equals("Activity") & showBehavior.Equals(DisplayMode.Behavior))
                {
                    // Open Behavior for Activity
                    Util.OpenBehaviorForElement(repository, el);
                }
                if (el.Type.Equals("State"))
                {
                    // get operations
                    foreach (Method m in el.Methods)
                    {
                        // display behaviors for methods
                        Appl.DisplayBehaviorForOperation(repository, m);
                    }
                }

                if (el.Type.Equals("Action"))
                {
                    foreach (CustomProperty custproperty in el.CustomProperties)
                    {
                        if (custproperty.Name.Equals("kind") && custproperty.Value.Equals("CallOperation"))
                        {
                            ShowFromElement(repository, el, showBehavior);
                        }
                        if (custproperty.Name.Equals("kind") && custproperty.Value.Equals("CallBehavior"))
                        {
                            el = repository.GetElementByID(el.ClassfierID);
                            Util.OpenBehaviorForElement(repository, el);
                        }
                    }
                }
                if (showBehavior.Equals(DisplayMode.Method) & (
                    el.Type.Equals("Activity") || el.Type.Equals("StateMachine") || el.Type.Equals("Interaction")))
                {
                    LocateOperationFromBehavior(repository, el, showBehavior);
                }
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:81,代码来源:EaServices.cs

示例3: SelectBehaviorFromConnector

        /// <summary>
        /// Display behavior or definition for selected connector ("StateFlow","Sequence"). It Displays the operation (displayMode=Method) or the Behavior (displayMode=Behavior).
        /// <para/>- enum displayMode: "Behavior" or "Method"
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="con"></param>
        /// <param name="showBehavior"></param>
        static void SelectBehaviorFromConnector(Repository repository, Connector con, DisplayMode showBehavior)
        {
            if (con.Type.Equals("StateFlow"))
            {
                Method m = Util.GetOperationFromConnector(repository, con);
                if (m != null)
                {
                    if (showBehavior.Equals(DisplayMode.Behavior))
                    {
                        Appl.DisplayBehaviorForOperation(repository, m);
                    }
                    else
                    {
                        repository.ShowInProjectView(m);
                    }
                }
            }

            if (con.Type.Equals("Sequence"))
            {
                // If name is of the form: OperationName(..) the operation is associated to an method
                string opName = con.Name;
                if (opName.EndsWith(")", StringComparison.Ordinal))
                {
                    // extract the name
                    int pos = opName.IndexOf("(", StringComparison.Ordinal);
                    opName = opName.Substring(0, pos);
                    Element el = repository.GetElementByID(con.SupplierID);
                    // find operation by name
                    foreach (Method op in el.Methods)
                    {
                        if (op.Name == opName)
                        {
                            repository.ShowInProjectView(op);
                            //Appl.DisplayBehaviorForOperation(Repository, op);
                            return;
                        }
                    }
                    // If connector 0 Sequence and Classifier exists
                    if (con.Type.Equals("Sequence") && ( el.ClassfierID > 0 || el.PropertyType > 0))
                    {
                        if ("PartPort".Contains(el.Type))
                        {
                            if (el.PropertyType > 0)
                            {
                                el = repository.GetElementByID(el.PropertyType);
                            }
                            else
                            {
                                if (el.ClassifierID > 0)
                                    el = repository.GetElementByID(el.ClassifierID);
                                else return;

                            }
                        }
                        else
                        {
                            if (el.ClassifierID > 0)
                                el = repository.GetElementByID(el.ClassifierID);
                        }

                        foreach (Method op in el.Methods)
                        {
                            if (op.Name == opName)
                            {
                                if (showBehavior.Equals(DisplayMode.Behavior))
                                {
                                    Appl.DisplayBehaviorForOperation(repository, op);
                                }
                                else
                                {
                                    repository.ShowInProjectView(op);
                                }
                            }
                        }
                    }
                }
            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:86,代码来源:EaServices.cs


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