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


C# EA.Update方法代码示例

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


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

示例1: CreateDiagram

 public static EA.Diagram CreateDiagram(EA.Package package, string diagramName, string diagramType)
 {
     EA.Diagram diagram = package.Diagrams.AddNew(diagramName, diagramType);
     diagram.ShowDetails = 0;
     diagram.Update();
     package.Update();
     return diagram;
 }
开发者ID:theedward,项目名称:xis-mobile,代码行数:8,代码来源:XISMobileHelper.cs

示例2: CreateDefaultElementsForActivity

        public static bool ActivityIsSimple = true; // Create Activity from function in the simple form
        public static bool CreateDefaultElementsForActivity(EA.Repository rep, 
                                EA.Diagram dia, EA.Element act)
        {
            // create init node
            CreateInitFinalNode(rep, dia, act, 100, @"l=350;r=370;t=70;b=90;");
            act.Elements.Refresh();
            dia.DiagramObjects.Refresh();
            dia.Update();
            rep.ReloadDiagram(dia.DiagramID);

            return true;
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:13,代码来源:ActivityPar.cs

示例3: UpdateAttribute

 public static bool UpdateAttribute(EA.Repository rep, EA.Attribute a)
 {
     // no classifier defined
     if (a.ClassifierID == 0)
     {
         // find type from type_name
         int id = GetTypeId(rep, a.Type);
         if (id > 0)
         {
             a.ClassifierID = id;
             bool error = a.Update();
             if (!error)
             {
                 MessageBox.Show(@"Error write Attribute", a.GetLastError());
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:20,代码来源:Util.cs

示例4: ChangeClassNameToSynonyms

        public static void ChangeClassNameToSynonyms(EA.Repository rep, EA.Element el)
        {
            if (el.Type.Equals("Class"))
            {
                // check if property 'Syynonym' exists
                foreach (EA.TaggedValue tag in el.TaggedValues)
                {
                    if (tag.Name == "typeSynonyms")
                    {
                        if (tag.Value != el.Name)
                        {
                            el.Name = tag.Value;
                            el.Update();
                            break;
                        }
                    }
                }
                foreach (EA.Element elNested in el.Elements)
                {
                    ChangeClassNameToSynonyms(rep, elNested);
                }

            }
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:24,代码来源:Util.cs

示例5: SetLineStyleForDiagramLink

        //--------------------------------------------------------------------------------------------------------------
        // setLineStyleForLink  Set line style for a digram link
        //--------------------------------------------------------------------------------------------------------------
        // linestyle
        // LH = "Line Style: Lateral Horizontal";
        // LV = "Line Style: Lateral Vertical";
        // TH  = "Line Style: Tree Horizontal";
        // TV = "Line Style: Tree Vertical";
        // OS = "Line Style: Orthogonal Square";
        // OR =              Orthogonal Round
        // A =               Automatic
        // D =               Direct
        // C =               Customer
        // B =               Bezier
        // NO=               make nothing
        public static void SetLineStyleForDiagramLink(string lineStyle, EA.DiagramLink link)
        {
            #pragma warning disable RECS0012
            lineStyle = lineStyle + "  "; 
            if (lineStyle.Substring(0, 2).ToUpper() == "NO") return;
            if (lineStyle.Substring(0,2) == "TH") lineStyle = "H ";
            if (lineStyle.Substring(0,2) == "TV") lineStyle = "V ";
            if (lineStyle.Substring(0,1) == "D") link.Style = "Mode=1;EOID=A36C0F5C;SOID=3ECFB522;Color=-1;LWidth=0;";
            else if (lineStyle.Substring(0,1) == "A") link.Style = "Mode=2;EOID=A36C0F5C;SOID=3ECFB522;Color=-1;LWidth=0;";
            else if (lineStyle.Substring(0,1) == "C") link.Style = "Mode=3;EOID=A36C0F5C;SOID=3ECFB522;Color=-1;LWidth=0;";
            else if (lineStyle.Substring(0,1) == "B") link.Style = "Mode=8;EOID=61B36ED5;SOID=08967F1E;Color=-1;LWidth=0;";
            else
            {
            link.Style = "Mode=3;EOID=A36C0F5C;SOID=3ECFB522;Color=-1;LWidth=0;TREE=" +
                                    lineStyle.Trim() + ";";

            }
            link.Update();
            #pragma warning restore RECS0012
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:35,代码来源:Util.cs

示例6: VisualizePortForDiagramobject

        public static void VisualizePortForDiagramobject(int pos, EA.Diagram dia, EA.DiagramObject diaObjSource, EA.Element port, 
            EA.Element interf, string portBoundTo = "right")
        {
            // check if port already exists
            foreach (EA.DiagramObject diaObjPort in dia.DiagramObjects)
            {
                if (diaObjPort.ElementID == port.ElementID) return;
            }

            // visualize ports
            int length = 12;
            int leftPort;
            int rightPort;
            // calculate target position of port
            if (portBoundTo == "right" || portBoundTo == "")
            {
                leftPort = diaObjSource.right - length / 2;
                rightPort = leftPort + length;
            }
            else
            {
                leftPort = diaObjSource.left - length / 2;
                rightPort = leftPort + length;

            }

            int top = diaObjSource.top;
                       

            int topPort = top - 35 - pos * 20 ;
            int bottomPort = topPort - length;

            // diagram object can't host port (not tall enough)
            // make diagram object taller to host all ports
            if (bottomPort <= diaObjSource.bottom)
            {
                diaObjSource.bottom = diaObjSource.bottom - 30; 
                diaObjSource.Update();
            }

            string position = "l=" + leftPort + ";r=" + rightPort + ";t=" + topPort + ";b=" + bottomPort + ";";
            var diaObjectPort = (EA.DiagramObject)dia.DiagramObjects.AddNew(position, "");
            if (port.Type.Equals("Port"))
            {
                // not showing label
                //diaObject.Style = "LBL=CX=97:CY=13:OX=45:OY=0:HDN=1:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";
                diaObjectPort.Style = "LBL=CX=200:CY=12:OX=23:OY=1:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";
            }
            else
            {

                // not showing label
                diaObjectPort.Style = "LBL=CX=97:CY=13:OX=39:OY=3:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";
            }
            diaObjectPort.ElementID = port.ElementID;


            diaObjectPort.Update();

            if (interf == null) return;

            // visualize interface
            var diaObject2 = (EA.DiagramObject)dia.DiagramObjects.AddNew(position, "");
            dia.Update();
            diaObject2.Style = "LBL=CX=69:CY=13:OX=45:OY=0:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";
            diaObject2.ElementID = interf.ElementID;
            diaObject2.Update();

        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:69,代码来源:Util.cs

示例7: VisualizePortForDiagramobject

        public static void VisualizePortForDiagramobject(int pos, EA.Diagram dia, EA.DiagramObject diaObjSource, EA.Element port, EA.Element interf)
        {
            // check if port already exists
            foreach (EA.DiagramObject diaObj in dia.DiagramObjects)
            {
                if (diaObj.ElementID == port.ElementID) return;
            }

            // visualize ports
            int length = 6;
            // calculate target position
            int left = diaObjSource.right - length / 2;
            int right = left + length;
            int top = diaObjSource.top;

            top = top - 10 - pos * 10;
            int bottom = top - length;
            string position = "l=" + left + ";r=" + right + ";t=" + top + ";b=" + bottom + ";";
            var diaObject = (EA.DiagramObject)dia.DiagramObjects.AddNew(position, "");
            dia.Update();
            if (port.Type.Equals("Port"))
            {
                // not showing label
                diaObject.Style = "LBL=CX=97:CY=13:OX=0:OY=0:HDN=1:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";
            }
            else
            {

                // not showing label
                diaObject.Style = "LBL=CX=97:CY=13:OX=39:OY=3:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";
            }
            diaObject.ElementID = port.ElementID;


            diaObject.Update();

            if (interf == null) return;

            // visualize interface
            var diaObject2 = (EA.DiagramObject)dia.DiagramObjects.AddNew(position, "");
            dia.Update();
            diaObject.Style = "LBL=CX=69:CY=13:OX=-69:OY=0:HDN=0:BLD=0:ITA=0:UND=0:CLR=-1:ALN=0:ALT=0:ROT=0;";
            diaObject2.ElementID = interf.ElementID;
            diaObject2.Update();

        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:46,代码来源:ActivityPar.cs

示例8: UpdateParameterFromOperation

        //-------------------------------------------------------------------------------------------------
        // get Parameter from operation
        // visualize them on diagram / activity
        //-------------------------------------------------------------------------------------------------
        public static bool UpdateParameterFromOperation(EA.Repository rep, EA.Element act, EA.Method m)
        {
            if (m == null) return false;
            if (act.Locked) return false;
            if (!act.Type.Equals("Activity")) return false;

            EA.Element parTrgt = null;


            ///////////////////////////////////////////////////////////////////////////////////
            // return code
            string parName = "Return";
            int methodReturnTypId;

            // is type defined?
            if ((m.ClassifierID != "0") & (m.ClassifierID != ""))
            {
                methodReturnTypId = Convert.ToInt32(m.ClassifierID);
            }
            
            // type is only defined as text
            else
            {
                methodReturnTypId = Convert.ToInt32(Util.GetTypeId(rep, m.ReturnType));
            }

            bool withActivityReturnParameter = false;
            if (withActivityReturnParameter)
            {
                parTrgt.ClassifierID = methodReturnTypId;
                // create an return Parameter for Activity (in fact an element with properties)
                parTrgt = Util.GetParameterFromActivity(rep, null, act, true);
                if (parTrgt == null)
                {
                    parTrgt = (EA.Element)act.EmbeddedElements.AddNew(parName, "Parameter");
                }
                else { parTrgt.Name = parName; }


                parTrgt.Alias = "return:" + m.ReturnType;
                parTrgt.ClassifierID = parTrgt.ClassifierID;

                parTrgt.Update();
                // update properties for return value
                var par = new Param(rep, parTrgt);
                par.SetParameterProperties("direction", "out");
                par.Save();
                par = null;
            }
            // returnType for activity
            act.ClassfierID = methodReturnTypId;
            act.Name = m.Name;

            // use stereotype of operation as stereotype for activity
            act.StereotypeEx = m.StereotypeEx;
            act.Update();
            act.EmbeddedElements.Refresh();

            // over all parameters
            string guids = "";
            foreach (EA.Parameter parSrc in m.Parameters)
            {
                // create an Parameter for Activity (in fact an element with properties)
                // - New if the parameter don't exists
                // - Update if the parameter exists
                // -- Update according to the parameter position

                //string direction = " [" + parSrc.Kind + "]";
                string direction = "";
                string prefixTyp = "";
                if (parSrc.IsConst) prefixTyp = " const";
                var postfixName = "";
                if (parSrc.Kind.Contains("out")) postfixName = "*";
                parName = parSrc.Position + ":" + parSrc.Name + postfixName + prefixTyp + direction;

                // check if parameter already exists (last parameter = false)
                parTrgt = Util.GetParameterFromActivity(rep, parSrc, act);



                // parameter doesn't exists
                if (parTrgt == null)
                {
                    parTrgt = (EA.Element)act.EmbeddedElements.AddNew(parName, "Parameter");
                }
                else
                {
                    parTrgt.Name = parName;
                }
                guids = guids + parTrgt.ElementGUID;

                // is type defined?
                if ((parSrc.ClassifierID != "0") & (parSrc.ClassifierID != ""))
                {
                    parTrgt.ClassifierID = Convert.ToInt32(parSrc.ClassifierID);
                }
//.........这里部分代码省略.........
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:101,代码来源:ActivityPar.cs

示例9: CreateDefaultElementsForStateDiagram

        //------------------------------------------------------------------------------
        // Create default Elements for Statemachine
        //------------------------------------------------------------------------------
        //
        // init
        // state 'State1'
        // final
        // transition from init to 'State1'

        public static bool CreateDefaultElementsForStateDiagram(EA.Repository rep, EA.Diagram dia, EA.Element stateChart)
        {

            // check if init and final node are available
            bool init = false;
            bool final = false;
            foreach (EA.Element node in stateChart.Elements)
            {
                init |= node.Type == "StateNode" & node.Subtype == 100;
                final |= node.Type == "StateNode" & node.Subtype == 101;
            }
            EA.Element initNode = null;
            if (!init)
            {
                initNode = (EA.Element)stateChart.Elements.AddNew("", "StateNode");
                initNode.Subtype = 3;
                initNode.ParentID = stateChart.ElementID;
                initNode.Update();
                if (dia != null)
                {
                    Util.AddSequenceNumber(rep, dia);
                    var initDiaNode = (EA.DiagramObject)dia.DiagramObjects.AddNew("l=295;r=315;t=125;b=135;", "");
                    initDiaNode.Sequence = 1;
                    initDiaNode.ElementID = initNode.ElementID;
                    initDiaNode.Update();
                    Util.SetSequenceNumber(rep, dia, initDiaNode, "1");
                }

            }
            EA.Element finalNode = null;
            // create final node
            if (!final)
            {
                finalNode = (EA.Element)stateChart.Elements.AddNew("", "StateNode");
                finalNode.Subtype = 4;
                finalNode.ParentID = stateChart.ElementID;
                finalNode.Update();
                if (dia != null)
                {
                    Util.AddSequenceNumber(rep, dia);
                    var finalDiaNode = (EA.DiagramObject)dia.DiagramObjects.AddNew("l=285;r=305;t=745;b=765;", "");
                    finalDiaNode.Sequence = 1;
                    finalDiaNode.ElementID = finalNode.ElementID;
                    finalDiaNode.Update();
                    Util.SetSequenceNumber(rep, dia, finalDiaNode, "1");
                }
            }
            // create state node
            var stateNode = (EA.Element)stateChart.Elements.AddNew("", "State");
            stateNode.Subtype = 0;// state
            stateNode.Name = "State1";
            stateNode.ParentID = stateChart.ElementID;
            stateNode.Update();
            if (dia != null)
            {
                Util.AddSequenceNumber(rep, dia);
                string pos = "l=300;r=400;t=-400;b=-470";
                var stateDiaNode = (EA.DiagramObject)dia.DiagramObjects.AddNew(pos, "");
                stateDiaNode.Sequence = 1;
                stateDiaNode.ElementID = stateNode.ElementID;
                stateDiaNode.Update();
                Util.SetSequenceNumber(rep, dia, stateDiaNode, "1");

                // draw a transition
                var con = (EA.Connector)finalNode.Connectors.AddNew("", "StateFlow");
                con.SupplierID = stateNode.ElementID;
                con.ClientID = initNode.ElementID;
                con.Update();
                finalNode.Connectors.Refresh();
            }


            stateChart.Elements.Refresh();
            dia.DiagramObjects.Refresh();
            dia.Update();
            rep.ReloadDiagram(dia.DiagramID);

            return true;
        }
开发者ID:Helmut-Ortmann,项目名称:EnterpriseArchitect_hoTools,代码行数:88,代码来源:Appl.cs


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