コード例 #1
0
        internal void OnPackagesChanged(IEnumerable <IPackage> added, IEnumerable <IPackage> removed, IEnumerable <IPackage> updated)
        {
            var reorderNeeded = false;

            foreach (var package in added)
            {
                if (PackageFiltering.instance.FilterByCurrentTab(package))
                {
                    var item = new PackageItem(package);
                    list.Add(item);
                    reorderNeeded = true;
                    UIUtils.SetElementDisplay(item, PackageFiltering.instance.FilterByCurrentSearchText(package));
                }
            }

            foreach (var package in removed)
            {
                var item = FindPackageItem(package);
                if (item != null)
                {
                    list.Remove(item);
                }
            }

            foreach (var package in updated)
            {
                var item = FindPackageItem(package);
                if (item != null)
                {
                    if (PackageFiltering.instance.FilterByCurrentTab(package))
                    {
                        if (!reorderNeeded && item.displayName != package.displayName)
                        {
                            reorderNeeded = true;
                        }
                        item.SetPackage(package);
                    }
                    else
                    {
                        list.Remove(item);
                    }
                }
                else if (PackageFiltering.instance.FilterByCurrentTab(package))
                {
                    item = new PackageItem(package);
                    list.Add(item);
                    reorderNeeded = true;
                }
                UIUtils.SetElementDisplay(item, PackageFiltering.instance.FilterByCurrentSearchText(package));
            }

            if (!m_PackagesLoaded && added.Any())
            {
                m_PackagesLoaded = true;
                onPackagesLoaded();
            }

            if (reorderNeeded)
            {
                ReorderPackageItems();
            }

            RefreshSelection();
        }
コード例 #2
0
 private void RefreshLabel()
 {
     text = PackageItem.GetVersionText(version);
 }
コード例 #3
0
 private static bool FilterByText(PackageItem item, string text)
 {
     return(item.package != null && FilterByText(item.package, text));
 }
コード例 #4
0
        private PackageItem GetPackageItem(string packageUniqueId)
        {
            PackageItem result = null;

            return((string.IsNullOrEmpty(packageUniqueId) || !m_PackageItemsLookup.TryGetValue(packageUniqueId, out result)) ? null : result);
        }