コード例 #1
0
        /// <summary>
        /// Wrapper to change DiagramLink style
        /// </summary>
        /// <param name="rep"></param>
        /// <param name="type"></param>
        /// <param name="style"></param>
        /// <param name="property"></param>
        /// <param name="changeScope"></param>
        public static void DiagramLinkStyleWrapper(Repository rep, string type, string style, string property, ChangeScope changeScope)
        {
            EaDiagram eaDia = new EaDiagram(rep, getAllDiagramObject: false);

            // Handle selected diagram and its selected items (connector/objects)
            if (eaDia.Dia != null)
            {
                rep.SaveDiagram(eaDia.Dia.DiagramID);
                // over all links
                foreach (var link in eaDia.GetSelectedLinks())
                {
                    var linkStyle = new DiagramLinkStyle(rep, link, type, style, property);
                    if (linkStyle.IsToProcess())
                    {
                        linkStyle.UpdateStyles();
                        linkStyle.SetProperties();
                        linkStyle.SetEaLayoutStyles();
                    }
                }
                eaDia.ReloadSelectedObjectsAndConnector(saveDiagram: false);
            }
            else
            {
                var liParameter = new string[4];
                liParameter[0] = type;
                liParameter[1] = style;
                liParameter[2] = property;

                switch (rep.GetContextItemType())
                {
                case EA.ObjectType.otPackage:
                    EA.Package pkg = (EA.Package)rep.GetContextObject();
                    RecursivePackages.DoRecursivePkg(rep, pkg, null, null,
                                                     SetDiagramLinkStyle,
                                                     liParameter,
                                                     changeScope);
                    break;

                case EA.ObjectType.otElement:
                    EA.Element el = (EA.Element)rep.GetContextObject();
                    RecursivePackages.DoRecursiveEl(rep, el, null,
                                                    SetDiagramLinkStyle,
                                                    liParameter,
                                                    changeScope);
                    break;
                }
            }
        }
コード例 #2
0
        /// <summary>
        /// Update all DiagramLinks of diagram
        /// - liParameter[0] = type;
        /// - liParameter[1] = style;</summary>
        /// - liParameter[2] = property;
        /// <param name="rep"></param>
        /// <param name="dia"></param>
        /// <param name="liParameter"></param>
        private static void SetDiagramLinkStyle(EA.Repository rep, EA.Diagram dia, string[] liParameter)
        {
            rep.SaveDiagram(dia.DiagramID);

            string types      = liParameter[0];
            string styles     = liParameter[1];
            string properties = liParameter[2];

            foreach (EA.DiagramLink link in dia.DiagramLinks)
            {
                var linkStyle = new DiagramLinkStyle(rep, link, types, styles, properties);
                if (linkStyle.IsToProcess())
                {
                    linkStyle.UpdateStyles();
                    linkStyle.SetProperties();
                    linkStyle.SetEaLayoutStyles();
                }
            }
            rep.ReloadDiagram(dia.DiagramID);
        }