private bool ShouldCheckCategory(AssetLibrary library, AssetCategory category) { if (AssetView.IsUserThemeCategory(category.Path)) { return(AssetLibrary.GetUserThemeName(library.ActiveUserThemeProvider) == category.Path.LastStep); } return(false); }
public void Dispose() { foreach (AssetCategoryPath index in (IEnumerable <AssetCategoryPath>) this.ExpandedCategories) { AssetCategory assetCategory = this.Host.RootCategory[index]; if (assetCategory != null) { assetCategory.IsExpanded = true; } } this.Host.SelectCategory(this.Host.RootCategory[this.SelectedCategory] ?? this.Host.RootCategory[(AssetCategoryPath)PresetAssetCategoryPath.ControlsRoot]); }
internal static ContextMenu GetThemeContextMenu(AssetLibrary library, AssetCategory category) { ICommandBar commandBar = library.DesignerContext.CommandBarService.CommandBars.AddContextMenu("Assets_UserTheme"); string lastStep = category.Path.LastStep; if (library.FindUserThemeProvider(lastStep) == null) { return((ContextMenu)null); } ICommandService commandService = library.DesignerContext.CommandService; commandService.SetCommandProperty("Assets_SetAsDefaultTheme", "Provider", (object)lastStep); commandService.SetCommandProperty("Assets_ResetSystemTheme", "Provider", (object)lastStep); commandService.SetCommandProperty("Assets_RestoreToDefaultContent", "Provider", (object)lastStep); commandBar.Items.AddCheckBox("Assets_SetAsDefaultTheme", StringTable.SetAsDefaultTheme); commandBar.Items.AddButton("Assets_ResetSystemTheme", StringTable.ResetSystemTheme); commandBar.Items.AddButton("Assets_RestoreToDefaultContent", StringTable.RestoreThemeContent); return((ContextMenu)commandBar); }
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) { AssetCategory category = (AssetCategory)values[0]; return((object)(Visibility)(this.ShouldCheckCategory(((AssetView)values[1]).Library, category) ? 0 : 2)); }