コード例 #1
0
        internal bool SelectNext(bool reverseOrder)
        {
            var selectedVersion = m_PageManager.GetSelectedVersion();
            var packageItem     = GetPackageItem(selectedVersion?.packageUniqueId);

            if (packageItem == null)
            {
                return(false);
            }

            // If the PackageItem is expanded, we want to start the search in the version list of the PackageItem
            if (packageItem.visualState.expanded)
            {
                var versionItem     = packageItem.versionItems.FirstOrDefault(v => v.targetVersion == selectedVersion);
                var nextVersionItem = UIUtils.FindNextSibling(versionItem, reverseOrder) as PackageVersionItem;
                if (nextVersionItem != null)
                {
                    m_PageManager.SetSelected(nextVersionItem.package, nextVersionItem.targetVersion, true);
                    return(true);
                }
            }

            // Otherwise we just select the next PackageItem
            var nextPackageItem = UIUtils.FindNextSibling(packageItem, reverseOrder) as PackageItem;

            if (nextPackageItem == null)
            {
                return(false);
            }

            if (nextPackageItem.visualState.expanded)
            {
                var versionItem = reverseOrder ? nextPackageItem.versionItems.LastOrDefault() : nextPackageItem.versionItems.FirstOrDefault();
                if (versionItem != null)
                {
                    m_PageManager.SetSelected(versionItem.package, versionItem.targetVersion, true);
                    return(true);
                }
            }
            m_PageManager.SetSelected(nextPackageItem.package, nextPackageItem.targetVersion, true);
            return(true);
        }