Пример #1
0
        private void RebuildCategories()
        {
            this.RootCategory = AssetCategory.CreateRootCategory();
            IXamlProject xamlProject = this.ActiveProject as IXamlProject;

            if (xamlProject != null && xamlProject.ProjectContext != null)
            {
                AssetTypeHelper typeHelper = new AssetTypeHelper(xamlProject.ProjectContext, this.Library.DesignerContext.PrototypingService);
                foreach (PresetAssetCategory category in Enum.GetValues(typeof(PresetAssetCategory)))
                {
                    AssetCategoryPath path = (AssetCategoryPath)PresetAssetCategoryPath.FromPreset(category);
                    if (this.FilterCategory(path, typeHelper))
                    {
                        this.RootCategory.CreateCategory(path);
                    }
                }
            }
            this.TreeFlattener.RebuildList(false);
            if (this.Categories.Count == 1)
            {
                this.Categories[0].IsExpanded = true;
            }
            this.OnPropertyChanged("Categories");
            this.OnPropertyChanged("RootItem");
            this.assetLibraryDamages &= ~AssetLibraryDamages.Categories;
            this.assetLibraryDamages |= AssetLibraryDamages.Assets;
            this.assetLibraryDamages |= AssetLibraryDamages.AssetCategories;
            this.assetLibraryDamages |= AssetLibraryDamages.CategoryCounts;
        }
Пример #2
0
 private void OnAssetLibraryChanged(AssetLibraryDamages damages)
 {
     if ((damages & AssetLibraryDamages.Assets) == AssetLibraryDamages.None)
     {
         return;
     }
     this.BeginInvokeUpdateMruValidState();
 }
Пример #3
0
 private void NotifyAssetLibraryChanged(AssetLibraryDamages damages)
 {
     if (this.AssetLibraryChanged == null)
     {
         return;
     }
     this.AssetLibraryChanged(damages);
 }
Пример #4
0
        private void CountAssetCategoriesWorker()
        {
            if (this.Library == null || this.Library.DesignerContext == null || !this.NeedRebuildCategoryCounts)
            {
                return;
            }
            using (PerformanceUtility.PerformanceSequence(PerformanceEvent.AssetViewRecountCategories))
            {
                EnumerableExtensions.ForEach <AssetCategory>(this.AllCategories(), (Action <AssetCategory>)(category => category.AssetCount = 0));
                foreach (Asset asset in this.GetAssetsForCategoryCounting())
                {
                    HashSet <AssetCategoryPath> hashSet = new HashSet <AssetCategoryPath>();
                    using (IEnumerator <AssetCategoryPath> enumerator = asset.Categories.GetEnumerator())
                    {
label_9:
                        while (enumerator.MoveNext())
                        {
                            AssetCategoryPath current = enumerator.Current;
                            hashSet.Add(current);
                            AssetCategoryPath assetCategoryPath = current;
                            while (true)
                            {
                                if (!assetCategoryPath.IsRoot && assetCategoryPath.AlwaysShow)
                                {
                                    hashSet.Add(assetCategoryPath);
                                    assetCategoryPath = assetCategoryPath.Parent;
                                }
                                else
                                {
                                    goto label_9;
                                }
                            }
                        }
                    }
                    foreach (AssetCategoryPath index in hashSet)
                    {
                        AssetCategory assetCategory = this.RootCategory[index];
                        if (assetCategory != null)
                        {
                            ++assetCategory.AssetCount;
                        }
                    }
                }
                EnumerableExtensions.ForEach <AssetCategory>(this.AllCategories(), (Action <AssetCategory>)(category => category.NotifyAssetCountChanged()));
                this.assetLibraryDamages &= ~AssetLibraryDamages.CategoryCounts;
            }
        }
Пример #5
0
 internal void UpdateAssets(AssetLibraryDamages damages)
 {
     this.assetLibraryDamages |= damages;
     if (!this.IsVisible && !AssetLibrary.DisableAsyncUpdate)
     {
         return;
     }
     if ((this.assetLibraryDamages & AssetLibraryDamages.ProjectChanged) != AssetLibraryDamages.None)
     {
         if (this.assets.Count > 0)
         {
             this.assets.Clear();
             this.primarySearchResult.Clear();
             this.secondarySearchResult.Clear();
             this.OnPropertyChanged("PrimarySearchResult");
             this.OnPropertyChanged("SecondarySearchResult");
         }
         this.assetLibraryDamages &= ~AssetLibraryDamages.ProjectChanged;
     }
     AssetView.AsyncCall.Invoke(ref this.updateAssetAsyncCall, new Action(this.UpdateAssetsWorker), this.Library.NeedsUpdate);
 }
Пример #6
0
        private void RebuildAssets()
        {
            this.assets.Clear();
            IXamlProject xamlProject = this.ActiveProject as IXamlProject;

            if (xamlProject != null)
            {
                AssetTypeHelper typeHelper = new AssetTypeHelper(xamlProject.ProjectContext, this.Library.DesignerContext.PrototypingService);
                foreach (Asset asset in this.Library.Assets)
                {
                    if (this.PrefilterAsset(asset, typeHelper))
                    {
                        if (asset.Categories == null || this.NeedRebuildAssetCategories)
                        {
                            asset.UpdateOnProject(this.ActiveProject, typeHelper);
                        }
                        if (this.FilterAsset(asset, typeHelper))
                        {
                            bool flag = false;
                            foreach (AssetCategoryPath path in (IEnumerable <AssetCategoryPath>)asset.Categories)
                            {
                                if (this.FilterCategory(path, typeHelper))
                                {
                                    flag = true;
                                    this.RootCategory.CreateCategory(path);
                                }
                            }
                            if (flag)
                            {
                                this.assets.Add(asset);
                            }
                        }
                    }
                }
            }
            this.assetLibraryDamages &= ~AssetLibraryDamages.Assets;
            this.assetLibraryDamages &= ~AssetLibraryDamages.AssetCategories;
            this.assetLibraryDamages |= AssetLibraryDamages.CategoryCounts;
        }
Пример #7
0
 private void OnAssetLibraryChanged(AssetLibraryDamages damages)
 {
     this.UpdateAssets(damages);
 }
Пример #8
0
 private void TransitionEffectPickerEditor_AssetLibraryChanged(AssetLibraryDamages obj)
 {
     this.UpdateFromDataContext();
 }