示例#1
0
        public static string GetSecondGenericType(NamedObjectSave collisionRelationship, out bool isList)
        {
            var secondName = collisionRelationship.Properties.GetValue <string>(nameof(CollisionRelationshipViewModel.SecondCollisionName));

            var container = collisionRelationship.GetContainer();

            string secondType = null;

            isList = false;

            if (container != null)
            {
                var secondObject = container.GetNamedObject(secondName);

                isList = secondObject?.IsList == true;

                if (secondObject != null)
                {
                    if (secondObject.IsList)
                    {
                        secondType = secondObject.SourceClassGenericType?.Replace("\\", ".");
                    }
                    else
                    {
                        secondType = NamedObjectSaveCodeGenerator.GetQualifiedTypeName(secondObject);
                    }
                }
            }

            return(secondType);
        }
示例#2
0
        public static void WriteSetStateOnNamedObject(NamedObjectSave namedObject, ICodeBlock codeBlock)
        {
            if (!string.IsNullOrEmpty(namedObject.CurrentState))
            {
                IElement referencedElement = namedObject.GetReferencedElement();
                if (referencedElement != null && referencedElement.GetUncategorizedStatesRecursively().Count != 0)
                {
                    string qualifiedName = NamedObjectSaveCodeGenerator.GetQualifiedTypeName(namedObject);

                    string lineToAdd = namedObject.FieldName + ".CurrentState = " + qualifiedName + ".VariableState." + namedObject.CurrentState + ";";
                    codeBlock.Line(lineToAdd);
                }
            }
        }