Пример #1
0
        /// <summary>
        /// Adds the given element to the collection
        /// </summary>
        /// <param name="item">The item to add</param>
        public virtual void Add(NMF.Models.Meta.IType item)
        {
            IComponentType componentTypesCasted = item.As <IComponentType>();

            if ((componentTypesCasted != null))
            {
                this._parent.ComponentTypes.Add(componentTypesCasted);
            }
            IInterface interfacesCasted = item.As <IInterface>();

            if ((interfacesCasted != null))
            {
                this._parent.Interfaces.Add(interfacesCasted);
            }
            ISystemSpecification systemSpecificationsCasted = item.As <ISystemSpecification>();

            if ((systemSpecificationsCasted != null))
            {
                this._parent.SystemSpecifications.Add(systemSpecificationsCasted);
            }
            IDelegate delegatesCasted = item.As <IDelegate>();

            if ((delegatesCasted != null))
            {
                this._parent.Delegates.Add(delegatesCasted);
            }
        }
Пример #2
0
        /// <summary>
        /// Removes the given item from the collection
        /// </summary>
        /// <returns>True, if the item was removed, otherwise False</returns>
        /// <param name="item">The item that should be removed</param>
        public virtual bool Remove(NMF.Models.Meta.IType item)
        {
            IComponentType componentTypeItem = item.As <IComponentType>();

            if (((componentTypeItem != null) &&
                 this._parent.ComponentTypes.Remove(componentTypeItem)))
            {
                return(true);
            }
            IInterface interfaceItem = item.As <IInterface>();

            if (((interfaceItem != null) &&
                 this._parent.Interfaces.Remove(interfaceItem)))
            {
                return(true);
            }
            ISystemSpecification systemSpecificationItem = item.As <ISystemSpecification>();

            if (((systemSpecificationItem != null) &&
                 this._parent.SystemSpecifications.Remove(systemSpecificationItem)))
            {
                return(true);
            }
            IDelegate delegateItem = item.As <IDelegate>();

            if (((delegateItem != null) &&
                 this._parent.Delegates.Remove(delegateItem)))
            {
                return(true);
            }
            return(false);
        }
        private void TestNext()
        {
            int hr = 0;

            IComponentType[] ts = new IComponentType[5];
            int    fetched;
            int    validObj = 0;
            IntPtr ip       = Marshal.AllocCoTaskMem(4);

            hr      = m_pEnum.Next(ts.Length, ts, ip);
            fetched = Marshal.ReadInt32(ip);
            Marshal.FreeCoTaskMem(ip);

            DsError.ThrowExceptionForHR(hr);

            for (int i = 0; i < fetched; i++)
            {
                if (ts[i] != null)
                {
                    validObj++;
                    Marshal.ReleaseComObject(ts[i]);
                }
            }

            Debug.Assert(validObj == fetched, "IEnumTuningSpaces.Next");
        }
Пример #4
0
        private void TestAdd()
        {
            int    hr;
            object o;

            IComponentType icomp = (IComponentType) new ComponentType();

            hr = m_compTypes.Add(icomp, out o);
            DsError.ThrowExceptionForHR(hr);
        }
Пример #5
0
        public virtual void AddComponent(Type type)
        {
            IComponentType annotation = GetComponentType(type);

            if (annotation == null)
            {
                throw new ArgumentException($"Type {type} does not provide component information.");
            }

            annotation.AddToModule(type, this);
        }
        private void Config()
        {
            int    hr;
            object o;

            IComponentTypes compTypes = (IComponentTypes) new ComponentTypes();

            IComponentType icomp = (IComponentType) new ComponentType();

            for (int x = 0; x < 7; x++)
            {
                hr = compTypes.Add(icomp, out o);
                DsError.ThrowExceptionForHR(hr);
            }

            hr = compTypes.EnumComponentTypes(out m_pEnum);
            DsError.ThrowExceptionForHR(hr);
        }
Пример #7
0
        public virtual void AddComponents(Func <Type, bool> filter = null, Assembly assembly = null)
        {
            if (assembly == null)
            {
                assembly = GetType().Assembly;
            }

            foreach (Type type in assembly.DefinedTypes)
            {
                IComponentType annotation = GetComponentType(type);
                if (annotation != null)
                {
                    if (filter(type))
                    {
                        annotation.AddToModule(type, this);
                    }
                }
            }
        }
Пример #8
0
 private void Config()
 {
     m_compType = (IComponentType) new ComponentType();
 }
Пример #9
0
 public GenericPackageData(IComponentType type, IList<IPropertyInfo> propertyDefinitions)
 {
     m_propertyDefinitions = propertyDefinitions;
     m_propertiesValue = new object[propertyDefinitions.Count];
     m_type = type;
 }
Пример #10
0
 public SpriteComponent(string spriteID)
 {
     m_ComponentType = ComponentType.Instance(Constant.enumComponent.SPRITE);
     m_SpriteID      = spriteID;
     m_isDrawn       = false;
 }
Пример #11
0
 public GenericPropertyInfo(IComponentType componentType, string name, int index)
 {
     m_index = index;
     m_name = name;
     m_componentType = componentType;
 }
Пример #12
0
 public IComponent getComponent(IComponentType componentType)
 {
     return(m_Components.Where(x => x.m_ComponentType == componentType).FirstOrDefault());
 }
Пример #13
0
 public ComponentTypeDto(IComponentType component) : base(component)
 {
     baseComponentType = component.BaseComponentTypeId;
 }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ComponentTypeReferencesCollection(IComponentType parent)
 {
     this._parent = parent;
     parent.RequiredInterfaces.AsNotifiable().CollectionChanged += this.HandleCollectionChange;
 }
 /// <summary>
 /// Creates a new instance
 /// </summary>
 public ComponentTypeBaseTypesCollection(IComponentType parent)
 {
     this._parent = parent;
     parent.ProvidedInterfaces.AsNotifiable().CollectionChanged += this.HandleCollectionChange;
 }