private void UpdateAssetsWorker() { if (this.openCount > 0 && this.NeedsUpdate && this.TargetProject != null) { bool flag = false; foreach (AssetProvider assetProvider in Enumerable.Reverse <AssetProvider>(this.FindAssetProviders <AssetProvider>())) { if (assetProvider.NeedsUpdate) { using (PerformanceUtility.PerformanceSequence(PerformanceEvent.AssetLibraryUpdateAssets)) { if (assetProvider.Update()) { if (!AssetLibrary.DisableAsyncUpdate) { this.NotifyAssetLibraryChanged(AssetLibraryDamages.Assets); this.InvokeAsync(new Action(this.UpdateAssetsWorker)); return; } } } } flag |= assetProvider.NeedsUpdate; } this.NeedsUpdate = flag; } if (this.needsUpdate) { return; } AssetLibrary.ResetAssetLoadPerformanceMarker(false); }
public bool ResetActiveWorkspace() { if (!this.OnActiveWorkspaceChanging()) { return(false); } using (PerformanceUtility.PerformanceSequence(PerformanceEvent.ResetWorkspace)) { Workspace workspace = new Workspace(this.activeWorkspace.Name, this.Content); WorkspaceService.WorkspaceOperationResult workspaceOperationResult = this.LoadWorkspaceConfiguration((IWorkspace)workspace, true); if (!workspaceOperationResult.Success) { if (this.messageDisplayService != null) { int num = (int)this.messageDisplayService.ShowMessage(new MessageBoxArgs() { Message = workspaceOperationResult.Message, Button = MessageBoxButton.OK, Image = MessageBoxImage.Hand }); } this.OnActiveWorkspaceChangingCanceled(); return(false); } this.ActiveWorkspace = (IWorkspace)workspace; } return(true); }
public bool SwitchToWorkspace(string workspaceName) { using (PerformanceUtility.PerformanceSequence(PerformanceEvent.SwitchWorkspaces)) { if (!this.factoryWorkspaceNames.Contains(workspaceName) && !this.customWorkspaceNames.Contains(workspaceName) || this.activeWorkspace.Name == workspaceName || !this.OnActiveWorkspaceChanging()) { return(false); } WorkspaceService.WorkspaceOperationResult workspaceOperationResult1 = this.SaveWorkspaceConfiguration(this.activeWorkspace, true); if (!workspaceOperationResult1.Success) { if (this.messageDisplayService != null) { if (this.messageDisplayService.ShowMessage(new MessageBoxArgs() { Message = workspaceOperationResult1.Message + " " + StringTable.WorkspaceConfigurationProceedSwitching, Button = MessageBoxButton.OKCancel, Image = MessageBoxImage.Exclamation }) != MessageBoxResult.OK) { this.OnActiveWorkspaceChangingCanceled(); return(false); } } else { this.OnActiveWorkspaceChangingCanceled(); return(false); } } Workspace workspace = new Workspace(workspaceName, this.Content); WorkspaceService.WorkspaceOperationResult workspaceOperationResult2 = this.LoadWorkspaceConfiguration((IWorkspace)workspace, false); if (!workspaceOperationResult2.Success) { if (this.messageDisplayService != null) { int num = (int)this.messageDisplayService.ShowMessage(new MessageBoxArgs() { Message = workspaceOperationResult2.Message, Button = MessageBoxButton.OK, Image = MessageBoxImage.Hand }); } if (this.customWorkspaceNames.Contains(workspaceName)) { this.customWorkspaceNames.Remove(workspaceName); } this.OnActiveWorkspaceChangingCanceled(); return(false); } this.ActiveWorkspace = (IWorkspace)workspace; } return(true); }
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; } }
private void UpdateSearchWorker() { if (this.Library == null || this.Library.DesignerContext == null) { return; } using (PerformanceUtility.PerformanceSequence(PerformanceEvent.AssetViewUpdateSearch)) { List <Asset> list1 = new List <Asset>(); List <Asset> list2 = new List <Asset>(); bool flag1 = false; bool flag2 = false; if (this.Library != null) { foreach (Asset asset in this.SearchAsset(this.SearchString, this.SelectedCategory, true)) { flag1 |= asset == this.SelectedAsset; list1.Add(asset); } foreach (Asset asset in this.SearchAsset(this.SearchString, this.SelectedCategory, false)) { flag2 |= asset == this.SelectedAsset; list2.Add(asset); } } this.IncrementallyChangeList <Asset>(this.primarySearchResult, (IList <Asset>)list1, Asset.AlphabeticComparer); this.IncrementallyChangeList <Asset>(this.secondarySearchResult, (IList <Asset>)list2, Asset.AlphabeticComparer); if (this.SelectedAsset != null && (!flag1 && !flag2 || flag1 && !this.BringAssetItemIntoView("PrimarySearchResultList") || flag2 && !this.BringAssetItemIntoView("SecondarySearchResultList"))) { this.SelectedAsset = (Asset)null; } if (!this.NeedRebuildCategoryCounts) { return; } this.CountAssetCategories(); } }
private void UpdateAssetsWorker() { if (this.Library == null || this.Library.DesignerContext == null) { return; } using (this.NeedRebuildCategories ? new AssetView.PreserveSelectionToken(this) : (AssetView.PreserveSelectionToken)null) { using (PerformanceUtility.PerformanceSequence(PerformanceEvent.AssetViewRebuildAssets)) { if (this.NeedRebuildCategories) { this.RebuildCategories(); } if (!this.NeedRebuildAssets && !this.NeedRebuildAssetCategories) { return; } this.RebuildAssets(); this.UpdateSearch(); } } }
public bool SaveAsNewWorkspace(string workspaceName) { using (PerformanceUtility.PerformanceSequence(PerformanceEvent.SaveWorkspace)) { if (this.factoryWorkspaceNames.Contains(workspaceName)) { throw new InvalidOperationException("Cannot overwrite factory workspace configuration."); } if (!this.OnActiveWorkspaceChanging()) { return(false); } Workspace workspace = new Workspace(workspaceName, this.Content); workspace.CopyConfiguration(this.activeWorkspace); WorkspaceService.WorkspaceOperationResult workspaceOperationResult = this.SaveWorkspaceConfiguration((IWorkspace)workspace, false); if (!workspaceOperationResult.Success) { if (this.messageDisplayService != null) { int num = (int)this.messageDisplayService.ShowMessage(new MessageBoxArgs() { Message = workspaceOperationResult.Message, Button = MessageBoxButton.OK, Image = MessageBoxImage.Hand }); } this.OnActiveWorkspaceChangingCanceled(); return(false); } if (!this.customWorkspaceNames.Contains(workspaceName)) { this.customWorkspaceNames.Add(workspaceName); } this.ActiveWorkspace = (IWorkspace)workspace; } return(true); }