Esempio n. 1
0
 /// <summary>
 ///    Remove the building block as used in the simulation
 /// </summary>
 public virtual void RemoveUsedBuildingBlock(UsedBuildingBlock usedBuildingBlock)
 {
     if (usedBuildingBlock == null)
     {
         return;
     }
     RemoveUsedBuildingBlock(usedBuildingBlock.TemplateId);
 }
Esempio n. 2
0
        /// <summary>
        ///    Update the version and structural version from the given building block, only if the building block is not loaded
        /// </summary>
        public virtual void UpdateVersionFrom(UsedBuildingBlock usedBuildingBlock)
        {
            if (usedBuildingBlock.BuildingBlock != null)
            {
                return;
            }

            Version          = usedBuildingBlock.Version;
            StructureVersion = usedBuildingBlock.StructureVersion;
        }
Esempio n. 3
0
        /// <summary>
        ///    Add a building block as being used by the simulation
        /// </summary>
        public virtual void AddUsedBuildingBlock(UsedBuildingBlock usedBuildingBlock)
        {
            if (usedBuildingBlock == null)
            {
                return;
            }

            var existingUsedBuildingBlock = UsedBuildingBlockByTemplateId(usedBuildingBlock.TemplateId);

            if (existingUsedBuildingBlock != null)
            {
                usedBuildingBlock.UpdateVersionFrom(existingUsedBuildingBlock);
                _usedBuildingBlocks.Remove(usedBuildingBlock.TemplateId);
            }

            _usedBuildingBlocks.Add(usedBuildingBlock);
        }
Esempio n. 4
0
 /// <summary>
 ///    Return true if the simulation uses the given building block otherwise false.
 /// </summary>
 public virtual bool UsesBuildingBlock(UsedBuildingBlock usedBuildingBlock)
 {
     return(UsesBuildingBlock(usedBuildingBlock.TemplateId));
 }