示例#1
0
        void UpdateIfNeeded(FrameDataView frameDataView, int selectedId)
        {
            var needReload = m_SelectedID != selectedId || !Equals(m_FrameDataView, frameDataView);

            if (!needReload)
            {
                return;
            }

            m_FrameDataView = frameDataView;
            m_SelectedID    = selectedId;
            m_TreeView.SetSelection(new List <int>());

            var samplesCount = m_FrameDataView.GetItemSamplesCount(selectedId);
            var columnsCount = m_MultiColumnHeader.columns.Length;

            var objectsData  = new List <ObjectInformation>();
            var objectsDatas = new string[columnsCount][];

            // Collect all the data
            var instanceIDs = m_FrameDataView.GetItemInstanceIDs(selectedId);

            for (var i = 0; i < columnsCount; i++)
            {
                objectsDatas[i] = m_FrameDataView.GetItemColumnDatas(selectedId, m_MultiColumnHeader.columns[i].profilerColumn);
            }

            // Store it per sample
            for (var i = 0; i < samplesCount; i++)
            {
                var objData = new ObjectInformation()
                {
                    columnStrings = new string[columnsCount]
                };
                objData.id = selectedId;

                objData.instanceId = (i < instanceIDs.Length) ? instanceIDs[i] : 0;
                for (var j = 0; j < columnsCount; j++)
                {
                    objData.columnStrings[j] = (i < objectsDatas[j].Length) ? objectsDatas[j][i] : string.Empty;
                }

                objectsData.Add(objData);
            }

            m_TreeView.SetData(objectsData);
        }