/// <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); } }
/// <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"); }
private void TestAdd() { int hr; object o; IComponentType icomp = (IComponentType) new ComponentType(); hr = m_compTypes.Add(icomp, out o); DsError.ThrowExceptionForHR(hr); }
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); }
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); } } } }
private void Config() { m_compType = (IComponentType) new ComponentType(); }
public GenericPackageData(IComponentType type, IList<IPropertyInfo> propertyDefinitions) { m_propertyDefinitions = propertyDefinitions; m_propertiesValue = new object[propertyDefinitions.Count]; m_type = type; }
public SpriteComponent(string spriteID) { m_ComponentType = ComponentType.Instance(Constant.enumComponent.SPRITE); m_SpriteID = spriteID; m_isDrawn = false; }
public GenericPropertyInfo(IComponentType componentType, string name, int index) { m_index = index; m_name = name; m_componentType = componentType; }
public IComponent getComponent(IComponentType componentType) { return(m_Components.Where(x => x.m_ComponentType == componentType).FirstOrDefault()); }
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; }