Example #1
0
        /// <summary>
        /// Given a node guid, this function will return the ElementId of the binding element.
        /// This function will work if only one element is created by the node.
        /// </summary>
        /// <param name="guid">the node guid</param>
        /// <returns>the element id</returns>
        private ElementId GetBindingElementIdForNode(Guid guid)
        {
            ProtoCore.Core core            = ViewModel.Model.EngineController.LiveRunnerCore;
            var            guidToCallSites = core.GetCallsitesForNodes(new [] { guid });
            var            callSites       = guidToCallSites[guid];

            if (!callSites.Any())
            {
                return(null);
            }
            var callSite      = callSites[0];
            var traceDataList = callSite.TraceData;

            if (!traceDataList.Any())
            {
                return(null);
            }
            var data = traceDataList[0].GetLeftMostData();
            var id   = data as SerializableId;

            return(new ElementId(id.IntID));
        }