/// <summary> /// Adds the given element to the collection /// </summary> /// <param name="item">The item to add</param> public override void Add(NMF.Models.IModelElement item) { IResourceContainer containerCasted = item.As <IResourceContainer>(); if ((containerCasted != null)) { this._parent.Container.Add(containerCasted); } IResourceLink linksCasted = item.As <IResourceLink>(); if ((linksCasted != null)) { this._parent.Links.Add(linksCasted); } }
/// <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 override bool Remove(NMF.Models.IModelElement item) { IResourceContainer resourceContainerItem = item.As <IResourceContainer>(); if (((resourceContainerItem != null) && this._parent.Container.Remove(resourceContainerItem))) { return(true); } IResourceLink resourceLinkItem = item.As <IResourceLink>(); if (((resourceLinkItem != null) && this._parent.Links.Remove(resourceLinkItem))) { return(true); } return(false); }