Start sections collapsed & restyle buttons
This commit is contained in:
		
							parent
							
								
									5817295f7c
								
							
						
					
					
						commit
						57775a9e22
					
				| @ -65,6 +65,8 @@ namespace Filtration.ViewModels | ||||
|         RelayCommand PasteBlockStyleCommand { get; } | ||||
|         RelayCommand ExpandAllBlocksCommand { get; } | ||||
|         RelayCommand CollapseAllBlocksCommand { get; } | ||||
|         RelayCommand ExpandAllSectionsCommand { get; } | ||||
|         RelayCommand CollapseAllSectionsCommand { get; } | ||||
|         RelayCommand<bool> ToggleShowAdvancedCommand { get; } | ||||
|         RelayCommand ClearFilterCommand { get; } | ||||
| 
 | ||||
| @ -148,6 +150,8 @@ namespace Filtration.ViewModels | ||||
|             PasteBlockStyleCommand = new RelayCommand(OnPasteBlockStyleCommand, () => SelectedBlockViewModel != null); | ||||
|             ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand); | ||||
|             CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand); | ||||
|             ExpandAllSectionsCommand = new RelayCommand(ExpandAllSections); | ||||
|             CollapseAllSectionsCommand = new RelayCommand(CollapseAllSections); | ||||
| 
 | ||||
|             var icon = new BitmapImage(); | ||||
|             icon.BeginInit(); | ||||
| @ -178,6 +182,7 @@ namespace Filtration.ViewModels | ||||
|             Title = Filename; | ||||
|             ContentId = "ScriptContentId"; | ||||
| 
 | ||||
|             CollapseAllSections(); | ||||
|             UpdateBlockModelsForView(); | ||||
|         } | ||||
| 
 | ||||
| @ -272,6 +277,8 @@ namespace Filtration.ViewModels | ||||
|         public RelayCommand PasteBlockStyleCommand { get; } | ||||
|         public RelayCommand ExpandAllBlocksCommand { get; } | ||||
|         public RelayCommand CollapseAllBlocksCommand { get; } | ||||
|         public RelayCommand ExpandAllSectionsCommand { get; } | ||||
|         public RelayCommand CollapseAllSectionsCommand { get; } | ||||
| 
 | ||||
|         public bool IsActiveDocument | ||||
|         { | ||||
| @ -1264,5 +1271,29 @@ namespace Filtration.ViewModels | ||||
| 
 | ||||
|             ViewItemFilterBlockViewModels = blocksForView; | ||||
|         } | ||||
| 
 | ||||
|         private void CollapseAllSections() | ||||
|         { | ||||
|             for (int i = 0; i < ItemFilterBlockViewModels.Count; i++) | ||||
|             { | ||||
|                 var block = ItemFilterBlockViewModels[i] as IItemFilterCommentBlockViewModel; | ||||
|                 if (block != null && block.IsExpanded) | ||||
|                 { | ||||
|                     ToggleSection(block); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
|         private void ExpandAllSections() | ||||
|         { | ||||
|             for (int i = 0; i < ItemFilterBlockViewModels.Count; i++) | ||||
|             { | ||||
|                 var block = ItemFilterBlockViewModels[i] as IItemFilterCommentBlockViewModel; | ||||
|                 if (block != null && !block.IsExpanded) | ||||
|                 { | ||||
|                     ToggleSection(block); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|     } | ||||
| } | ||||
|  | ||||
| @ -119,6 +119,9 @@ namespace Filtration.ViewModels | ||||
|             ExpandAllBlocksCommand = new RelayCommand(OnExpandAllBlocksCommand, () => ActiveDocumentIsScript); | ||||
|             CollapseAllBlocksCommand = new RelayCommand(OnCollapseAllBlocksCommand, () => ActiveDocumentIsScript); | ||||
| 
 | ||||
|             ExpandAllSectionsCommand = new RelayCommand(OnExpandAllSectionsCommand, () => ActiveDocumentIsScript); | ||||
|             CollapseAllSectionsCommand = new RelayCommand(OnCollapseAllSectionsCommand, () => ActiveDocumentIsScript); | ||||
| 
 | ||||
|             ToggleShowAdvancedCommand = new RelayCommand<bool>(OnToggleShowAdvancedCommand, s => ActiveDocumentIsScript); | ||||
|             ClearFiltersCommand = new RelayCommand(OnClearFiltersCommand, () => ActiveDocumentIsScript); | ||||
| 
 | ||||
| @ -230,6 +233,9 @@ namespace Filtration.ViewModels | ||||
|         public RelayCommand ExpandAllBlocksCommand { get; } | ||||
|         public RelayCommand CollapseAllBlocksCommand { get; } | ||||
| 
 | ||||
|         public RelayCommand ExpandAllSectionsCommand { get; } | ||||
|         public RelayCommand CollapseAllSectionsCommand { get; } | ||||
| 
 | ||||
|         public RelayCommand<bool> ToggleShowAdvancedCommand { get; } | ||||
|         public RelayCommand ClearFiltersCommand { get; } | ||||
| 
 | ||||
| @ -636,6 +642,16 @@ namespace Filtration.ViewModels | ||||
|             _avalonDockWorkspaceViewModel.ActiveScriptViewModel.CollapseAllBlocksCommand.Execute(null); | ||||
|         } | ||||
| 
 | ||||
|         private void OnExpandAllSectionsCommand() | ||||
|         { | ||||
|             _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ExpandAllSectionsCommand.Execute(null); | ||||
|         } | ||||
| 
 | ||||
|         private void OnCollapseAllSectionsCommand() | ||||
|         { | ||||
|             _avalonDockWorkspaceViewModel.ActiveScriptViewModel.CollapseAllSectionsCommand.Execute(null); | ||||
|         } | ||||
| 
 | ||||
|         private void OnToggleShowAdvancedCommand(bool showAdvanced) | ||||
|         { | ||||
|             _avalonDockWorkspaceViewModel.ActiveScriptViewModel.ToggleShowAdvancedCommand.Execute(showAdvanced); | ||||
|  | ||||
| @ -101,10 +101,13 @@ | ||||
|                     <fluent:Button Header="Move To Bottom" Command="{Binding MoveBlockToBottomCommand}"  SizeDefinition="Middle" Icon="{StaticResource MoveToBottomIcon}" /> | ||||
|                     <fluent:Button Header="Enable Block" Command="{Binding EnableBlockCommand}"  SizeDefinition="Middle" Icon="{StaticResource StandbyEnabledIcon}" /> | ||||
|                     <fluent:Button Header="Disable Block" Command="{Binding DisableBlockCommand}"  SizeDefinition="Middle" Icon="{StaticResource StandbyDisabledIcon}" /> | ||||
|                 </fluent:RibbonGroupBox> | ||||
|                 <fluent:RibbonGroupBox Header="Sections"> | ||||
|                     <fluent:Button Header="Enable Section" Command="{Binding EnableSectionCommand}"  SizeDefinition="Middle" Icon="{StaticResource StandbyEnabledIcon}" /> | ||||
|                     <fluent:Button Header="Disable Section" Command="{Binding DisableSectionCommand}"  SizeDefinition="Middle" Icon="{StaticResource StandbyDisabledIcon}" /> | ||||
|                     <fluent:Button Header="Expand Section" Command="{Binding ExpandSectionCommand}"  SizeDefinition="Middle" Icon="{StaticResource StandbyEnabledIcon}" /> | ||||
|                     <fluent:Button Header="Collapse Section" Command="{Binding CollapseSectionCommand}"  SizeDefinition="Middle" Icon="{StaticResource StandbyDisabledIcon}" /> | ||||
|                     <fluent:Button Header=""  SizeDefinition="Middle" IsEnabled="False" /> | ||||
|                     <fluent:Button Header="Expand All Sections" Command="{Binding ExpandAllSectionsCommand}" SizeDefinition="Middle" Icon="{StaticResource ExpandIcon}" /> | ||||
|                     <fluent:Button Header="Collapse All Sections" Command="{Binding CollapseAllSectionsCommand}" SizeDefinition="Middle" Icon="{StaticResource CollapseIcon}" /> | ||||
|                 </fluent:RibbonGroupBox> | ||||
|                 <fluent:RibbonGroupBox Header="Expand / Collapse"> | ||||
|                     <fluent:Button Header="Expand All" Command="{Binding ExpandAllBlocksCommand}" SizeDefinition="Middle" Icon="{StaticResource ExpandIcon}" /> | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user