private void UpdateStatusFilter(ProgressElement el)
 {
     if (el.dataSource.status == Progress.Status.Canceled)
     {
         UpdateStatusFilter(el.rootVisualElement, m_FilterCancelled.value);
     }
     else if (el.dataSource.status == Progress.Status.Failed)
     {
         UpdateStatusFilter(el.rootVisualElement, m_FilterFailed.value);
     }
     else if (el.dataSource.status == Progress.Status.Succeeded)
     {
         UpdateStatusFilter(el.rootVisualElement, m_FilterSuccess.value);
     }
 }
        private ProgressElement AddElement(Progress.Item progressItem)
        {
            if (progressItem.parentId >= 0)
            {
                for (int i = 0; i < m_Elements.Count; ++i)
                {
                    if (progressItem.parentId == m_Elements[i].dataSource.id)
                    {
                        m_Elements[i].AddElement(progressItem);
                        return(m_Elements[i]);
                    }
                }
                Assert.IsTrue(true);
            }
            // if parent was not found
            var element = new ProgressElement(progressItem);

            if (m_Elements.Count > 0 && progressItem.status == Progress.Status.Failed)
            {
                var insertIndex = -1;
                for (int i = 0; i < m_Elements.Count; i++)
                {
                    if ((m_Elements[i].dataSource.status == Progress.Status.Failed && progressItem.updateTime > m_Elements[i].dataSource.updateTime) ||
                        m_Elements[i].dataSource.status != Progress.Status.Failed)
                    {
                        insertIndex = i;
                        break;
                    }
                }
                m_Elements.Insert(insertIndex, element);
                m_ScrollView.Insert(insertIndex, element.rootVisualElement);
                if (insertIndex > m_LastParentFailedIndex)
                {
                    m_LastParentFailedIndex = insertIndex;
                }
                return(element);
            }
            else
            {
                m_Elements.Insert(m_LastParentFailedIndex + 1, element);
                m_ScrollView.Insert(m_LastParentFailedIndex + 1, element.rootVisualElement);
            }
            return(element);
        }