public SnapshotUIWidthData(OpenSnapshotItemUI uiItem, float snapshotMinWidth)
 {
     NameData = new LabelWidthData(string.IsNullOrEmpty(uiItem.Name.text)?uiItem.NoData:uiItem.Name, snapshotMinWidth);
     DateData = new LabelWidthData(uiItem.Date, snapshotMinWidth);
 }
        void InitializeOpenSnapshotItem(VisualTreeAsset openSnapshotItemTree, Dictionary <string, VisualElement> openSnapshotItemSlots, VisualElement snapshotHolder, ref OpenSnapshotItemUI openSnapshotItemUI, Action openSnapshotHandler)
        {
#if UNITY_2019_1_OR_NEWER
            var item = openSnapshotItemTree.CloneTree();
#else
            openSnapshotItemSlots.Clear();
            var item = openSnapshotItemTree.CloneTree(openSnapshotItemSlots);
#endif
            item.style.flexGrow = 1;
            snapshotHolder.Add(item);
            item.AddManipulator(new Clickable(openSnapshotHandler));
            openSnapshotItemUI.Item               = item;
            openSnapshotItemUI.Image              = item.Q <Image>("previewImage", "previewImage");
            openSnapshotItemUI.Image.scaleMode    = ScaleMode.ScaleToFit;
            openSnapshotItemUI.PlatformIcon       = item.Q <Image>("platformIcon", "platformIcon");
            openSnapshotItemUI.EditorPlatformIcon = item.Q <Image>("editorIcon", "platformIcon");
            openSnapshotItemUI.NoData             = item.Q <Label>("noDataLoaded");
            openSnapshotItemUI.Name               = item.Q <Label>("snapshotName");
            openSnapshotItemUI.Date               = item.Q <Label>("snapshotDate");
            openSnapshotItemUI.Age = item.Q <Label>("snapshotAge");
            UIElementsHelper.SetVisibility(openSnapshotItemUI.PlatformIcon, false);
            UIElementsHelper.SetVisibility(openSnapshotItemUI.EditorPlatformIcon, false);
            UIElementsHelper.SetVisibility(openSnapshotItemUI.NoData, true);
            UIElementsHelper.SetVisibility(openSnapshotItemUI.Name, false);
        }
        public void SetSnapshotUIData(bool first, SnapshotFileGUIData snapshotGUIData, bool isInView)
        {
            OpenSnapshotItemUI itemUI = m_OpenSnapshotItemUIFirst;

            if (!first)
            {
                itemUI = m_OpenSnapshotItemUISecond;
            }
            if (snapshotGUIData == null)
            {
                UIElementsHelper.SwitchVisibility(itemUI.NoData, itemUI.Name);
                itemUI.Name.text   = "";
                itemUI.Date.text   = "";
                itemUI.Age.text    = "";
                itemUI.Image.image = null;
                UIElementsHelper.SetVisibility(itemUI.PlatformIcon, false);
                UIElementsHelper.SetVisibility(itemUI.EditorPlatformIcon, false);
                itemUI.UtcDateTime = default(DateTime);
                // one of both snapshots is not open so there is no Age comparison between them.
                m_OpenSnapshotItemUIFirst.Age.text  = "";
                m_OpenSnapshotItemUISecond.Age.text = "";
            }
            else
            {
                UIElementsHelper.SwitchVisibility(itemUI.Name, itemUI.NoData);
                itemUI.Name.text   = snapshotGUIData.Name.text;
                itemUI.Date.text   = snapshotGUIData.SnapshotDate.text;
                itemUI.Image.image = snapshotGUIData.MetaScreenshot;
                UIElementsHelper.SetVisibility(itemUI.PlatformIcon, true);
                MemoryProfilerWindow.SetPlatformIcons(itemUI.Item, snapshotGUIData);
                UIElementsHelper.SwitchVisibility(snapshotGUIData.dynamicVisualElements.closeButton, snapshotGUIData.dynamicVisualElements.openButton, true);
                itemUI.UtcDateTime = snapshotGUIData.UtcDateTime;
                if (first && secondIsOpen || !first && firstIsOpen)
                {
                    m_OpenSnapshotItemUIFirst.Age.text  = GetAgeDifference(m_OpenSnapshotItemUIFirst.UtcDateTime, m_OpenSnapshotItemUISecond.UtcDateTime);
                    m_OpenSnapshotItemUISecond.Age.text = GetAgeDifference(m_OpenSnapshotItemUISecond.UtcDateTime, m_OpenSnapshotItemUIFirst.UtcDateTime);
                }
            }
            if (first)
            {
                firstIsOpen = snapshotGUIData != null;
            }
            else
            {
                secondIsOpen = snapshotGUIData != null;
            }

            if (isInView)
            {
                SetFocusFirst(first);
                SetFocusSecond(!first);
                SetFocusDiff(false);
            }
            else
            {
                if (first)
                {
                    SetFocusFirst(false);
                }
                else
                {
                    SetFocusSecond(false);
                }
            }

            m_DiffButton.SetEnabled(firstIsOpen && secondIsOpen);

            UpdateWidth(layout.width);
        }