예제 #1
0
        private void ConnectIndex(IDomain domain, IArea currentArea, IObject currentObject, ref bool IsConnected)
        {
            IObject Object = IndexObject;
            IObjectPropertyIndex ObjectProperty = IndexObjectProperty;

            IsConnected        |= IndexProperty.ConnectToObjectIndex(domain, currentArea, currentObject, ref Object, ref ObjectProperty);
            IndexObject         = Object;
            IndexObjectProperty = ObjectProperty;

            IndexObjectProperty?.SetIsReadWrite();
        }
예제 #2
0
        public override void ConnectComponents(IDomain domain, IDynamic currentDynamic, IReadOnlyCollection <IComponent> components)
        {
            base.ConnectComponents(domain, currentDynamic, components);

            if (Index == null)
            {
                throw new ParsingException(200, Source, $"StatePanel has no index.");
            }

            IComponent FoundComponent = null;

            foreach (IComponent Item in components)
            {
                if (Item.Source.Name == Index)
                {
                    FoundComponent = Item;
                    break;
                }
            }

            if (FoundComponent is IComponentIndex AsIndexComponent)
            {
                IObjectPropertyIndex IndexObjectProperty = AsIndexComponent.IndexObjectProperty;

                if (IndexObjectProperty is IObjectPropertyBoolean AsBooleanProperty)
                {
                    if (Items.Count != 2)
                    {
                        throw new ParsingException(201, Source, $"StatePanel is referencing '{Index}' but doesn't have the two items expected for a boolean property.");
                    }
                }
                else if (Items.Count < 2)
                {
                    throw new ParsingException(202, Source, $"StatePanel must have at least two items.");
                }

                Component = AsIndexComponent;
                Component.SetIsUsed();
            }

            else if (FoundComponent == null)
            {
                throw new ParsingException(171, Source, $"StatePanel is referencing '{Index}' but this index doesn't exist.");
            }

            else
            {
                throw new ParsingException(172, Source, $"StatePanel is referencing '{Index}' but this component is not an index.");
            }
        }
 public GeneratorObjectPropertyIndex(IObjectPropertyIndex property, IGeneratorObject obj)
     : base(property, obj)
 {
 }
예제 #4
0
        public bool ConnectToObjectIndex(IDomain domain, IArea currentArea, IObject currentObject, ref IObject obj, ref IObjectPropertyIndex objectProperty)
        {
            bool IsConnected = false;

            if ((ObjectSource != null || ObjectPropertySource != null) && (obj == null || objectProperty == null))
            {
                ConnectToObject(domain, currentArea, ObjectSource, ObjectPropertySource, ObjectPropertyKey, ref obj);

                foreach (IObjectProperty Property in obj.Properties)
                {
                    if (Property.NameSource.Name == ObjectPropertySource.Name)
                    {
                        if (Property is IObjectPropertyIndex AsObjectPropertyIndex)
                        {
                            objectProperty = AsObjectPropertyIndex;
                            break;
                        }
                        else
                        {
                            throw new ParsingException(153, ObjectPropertySource.Source, $"'{obj.Name}.{ObjectPropertySource.Name}' must be an integer, enum or boolean property.");
                        }
                    }
                }

                if (objectProperty == null)
                {
                    throw new ParsingException(141, ObjectPropertySource.Source, $"Unknown property '{ObjectPropertySource.Name}' in object '{obj.Name}'.");
                }

                IsConnected = true;
            }

            return(IsConnected);
        }