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


C# Model.adviseChange方法代码示例

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


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

示例1: correct

        /// <summary>
        /// Correct detected defect based on value in contentCorrect attribute
        /// </summary>
        /// <param name="element">Defected element</param>
        /// <param name="model">Wrapper EA.Repository object</param>
        /// <returns>true if correction was successful, else false</returns>
        public bool correct(object element, Model model)
        {
            string[] correctCall = contentCorrect.Split('@');

            for (int i = 0; i < correctCall.Length; i++)
            {
                try
                {
                    if (correctCall[i].StartsWith("setName"))
                    {
                        string[] nameExpression = correctCall[i].Split('(', ')')[1].Split('.');
                        for (int j = 0; j < nameExpression.Length; j++)
                        {
                            if (nameExpression[j] == "dict")
                            {
                                Dictionary dict = new Dictionary();
                                if (nameExpression[j + 1].StartsWith("getBaseNoun"))
                                {
                                    string attributeName = correctCall[i].Split('(', ')')[2];
                                    string value = getStringAttributeValue(element, attributeName);
                                    string word = dict.getBaseNoun(value);

                                    if (word == "")
                                    {
                                        return false;
                                    }

                                    setStringAttributeValue(element, attributeName, word);
                                    try
                                    {
                                        model.adviseChange((new ElementWrapper(model, (EA.Element)element)));
                                        RuleService.active.Remove(getStringAttributeValue(element, "GUID"));
                                    }
                                    catch (Exception ex) { }

                                    return true;
                                }
                            }
                            else
                            {
                                setStringAttributeValue(element, attributeType, nameExpression[j]);
                                try
                                {
                                    if (element is EA.Connector)
                                    {
                                        model.adviseChange(new ConnectorWrapper(model, (EA.Connector)element));
                                    }
                                    else
                                    {
                                        model.adviseChange(new ElementWrapper(model, (EA.Element)element));
                                    }
                                }
                                catch (Exception ex) { }

                                return true;
                            }
                        }
                    }

                    if (correctCall[i].StartsWith("setCardinalities"))
                    {
                        string nameExpression = correctCall[i].Split('(', ')')[1];

                        object objectClient = getAttributeValue(element, "ClientEnd");
                        string cardinalityClient = getStringAttributeValue(objectClient, "Cardinality");

                        object objectSupplier = getAttributeValue(element, "SupplierEnd");
                        string cardinalitySupplier = getStringAttributeValue(objectSupplier, "Cardinality");

                        if (String.IsNullOrEmpty(cardinalityClient))
                        {
                            setStringAttributeValue(objectClient, "Cardinality", nameExpression);
                        }

                        if (String.IsNullOrEmpty(cardinalitySupplier))
                        {
                            setStringAttributeValue(objectSupplier, "Cardinality", nameExpression);
                        }

                        try
                        {
                            model.adviseChange(new ConnectorWrapper(model, (EA.Connector)element));
                        }
                        catch (Exception ex) { }
                    }

                    if (correctCall[i].StartsWith("setExtensionPointsCount"))
                    {
                        string nameExpression = correctCall[i].Split('(', ')')[1];
                        if (nameExpression.StartsWith("Connector"))
                        {
                            string expr = nameExpression.Split('.')[1];
                            if (expr == "getStereotypeCount")
                            {
//.........这里部分代码省略.........
开发者ID:JOndik,项目名称:SmallTEAmsHelper,代码行数:101,代码来源:Rule.cs


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