Exemple #1
0
        /// <summary>Gets the block interface information.</summary>
        /// <returns>BlockInterface</returns>
        /// TODO Edit XML Comment Template for GetBlockInterfaceInformation
        private BlockInterface GetBlockInterfaceInformation()
        {
            //add xml specific namespace
            //XmlNamespaceManager ns = new XmlNamespaceManager(Document.NameTable);
            //ns.AddNamespace("SI", "http://www.siemens.com/automation/Openness/SW/Interface/v1");

            //local BlockInformation Object
            var blockInterface = new BlockInterface();

            ParseInterface(RootNode.SelectNodes("//Interface/SI:Sections/SI:Section", _ns), blockInterface.InterfaceSections);

            return(blockInterface);
        }
    void UpdatePlaceStatus()
    {
        if (currentInteractor)
        {
            Vector3 spawnPos = CalculateSpawnPosition();

            newGO = Instantiate(buildingBlockPrefab, spawnPos,
                                currentInteractorTf.rotation, parent);
            newBI = newGO.GetComponent <BlockInterface>();

            currentInteractor.block.AddDependancy(newBI);
            newBI.AddDependancy(currentInteractor.block);
        }
    }
        private void BlockInterfaceEvent(object pars)
        {
            BlockInterface handler = (BlockInterface)((object[])pars)[0];
            Order          order   = (Order)((object[])pars)[1];

            try
            {
                handler(order);
            }
            catch (Exception)
            {
                Console.WriteLine("[TriggerOrderEvent]: Exception");
                blockInterface -= handler;
            }
        }
 public void GeneratePreviewBuildingBlock()
 {
     if (!buildingBlockPrefab.GetComponent <BlockInterface>())
     {
         Debug.Log("Prefab doesn't have a Block Interface Script");
         return;
     }
     if (previewGO)
     {
         Destroy(previewGO);
     }
     previewGO       = Instantiate(buildingBlockPrefab, transform);
     previewTf       = previewGO.transform;
     previewBI       = previewGO.GetComponent <BlockInterface>();
     previewGO.layer = 2;
     previewBI.SetAsPreview(previewMaterial);
 }
        /// <summary>
        /// Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns>A <see cref="System.String" /> that represents this instance.</returns>
        /// TODO Edit XML Comment Template for ToString
        public override string ToString()
        {
            var ret = "";
            var id  = 0;

            ret += "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + Environment.NewLine;
            ret += "<Document>" + Environment.NewLine;
            ret += "<SW.DataBlock ID=\"" + id++ + "\">" + Environment.NewLine;
            ret += "<AttributeList>" + Environment.NewLine;
            ret += "<AutoNumber>" + AdjustNames.AdjustXmlStrings(BlockAutoNumber) + "</AutoNumber>" + Environment.NewLine;
            ret += "<DownloadWithoutReinit>" + AdjustNames.AdjustXmlStrings(DownloadWithoutReinit) + "</DownloadWithoutReinit>" + Environment.NewLine;
            ret += "<DatablockType>" + AdjustNames.AdjustXmlStrings(DbType.ToString()) + "</DatablockType>" + Environment.NewLine;
            ret += "<HeaderAuthor>" + AdjustNames.AdjustXmlStrings(BlockAuthor) + "</HeaderAuthor>" + Environment.NewLine;
            ret += "<HeaderFamily>" + AdjustNames.AdjustXmlStrings(BlockFamily) + "</HeaderFamily>" + Environment.NewLine;
            ret += "<HeaderName>" + AdjustNames.AdjustXmlStrings(BlockUserId) + "</HeaderName>" + Environment.NewLine;
            ret += "<HeaderVersion>" + AdjustNames.AdjustXmlStrings(BlockVersion) + "</HeaderVersion>" + Environment.NewLine;
            ret += "<InstanceOfName>" + AdjustNames.AdjustXmlStrings(InstanceOfName) + "</InstanceOfName>" + Environment.NewLine;
            ret += BlockInterface.ToString();
            ret += "<IsOnlyStoredInLoadMemory>" + AdjustNames.AdjustXmlStrings(IsOnlyStoredInLoadMemory) + "</IsOnlyStoredInLoadMemory>" + Environment.NewLine;
            ret += "<IsRetainMemResEnabled>" + AdjustNames.AdjustXmlStrings(IsRetainMemResEnabled) + "</IsRetainMemResEnabled>" + Environment.NewLine;
            ret += "<IsWriteProtectedInAS>" + AdjustNames.AdjustXmlStrings(IsWriteProtectedInAs) + "</IsWriteProtectedInAS>" + Environment.NewLine;
            ret += "<MemoryLayout>" + AdjustNames.AdjustXmlStrings(BlockMemoryLayout) + "</MemoryLayout>" + Environment.NewLine;
            ret += "<MemoryReserve>" + AdjustNames.AdjustXmlStrings(MemoryReserve) + "</MemoryReserve>" + Environment.NewLine;
            ret += "<Name>" + AdjustNames.AdjustXmlStrings(Name) + "</Name>" + Environment.NewLine;
            ret += "<Number>" + BlockNumber + "</Number>" + Environment.NewLine;
            ret += "<ProgrammingLanguage>DB</ProgrammingLanguage>" + Environment.NewLine;
            ret += "<Type>DB</Type>" + Environment.NewLine;
            ret += "</AttributeList>" + Environment.NewLine;
            ret += "<ObjectList>" + Environment.NewLine;
            ret += BlockComment.ToString(ref id);
            ret += BlockTitle.ToString(ref id);
            ret += "</ObjectList>" + Environment.NewLine;
            ret += "</SW.DataBlock>" + Environment.NewLine;
            ret += "</Document>" + Environment.NewLine;
            return(ret);
        }
Exemple #6
0
 public void  SetBlock(BlockInterface b)
 {
     block = b;
 }
Exemple #7
0
 public void SetBlock(BlockInterface b)
 {
     block = b;
 }
Exemple #8
0
 public void RemoveDependancy(BlockInterface bi)
 {
     connectedBlocks.Remove(bi);
 }
Exemple #9
0
 public void AddDependancy(BlockInterface bi)
 {
     connectedBlocks.Add(bi);
 }