From 0eafd59e799941ccd739860f279f508c67140edb Mon Sep 17 00:00:00 2001 From: Ben Date: Mon, 22 Jun 2015 21:00:13 +0100 Subject: [PATCH] Set BlockGroupBrowser pane to not be closeable --- Filtration/Filtration.csproj | 3 ++ .../ItemFilterScriptRepository.cs | 1 - .../ViewModels/ItemFilterBlockViewModel.cs | 20 +++++------ .../AvalonDock/AvalonDockWorkspaceView.xaml | 8 +++-- .../Views/AvalonDock/LayoutInitializer.cs | 33 ++++++------------- Filtration/Views/ItemFilterBlockView.xaml | 6 ++-- Filtration/Views/ItemFilterBlockView.xaml.cs | 16 ++++++++- .../ToolPanes/SectionBrowserView.xaml.cs | 10 ++++++ 8 files changed, 57 insertions(+), 40 deletions(-) create mode 100644 Filtration/Views/ToolPanes/SectionBrowserView.xaml.cs diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index a40576d..ac68abf 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -102,6 +102,9 @@ ..\packages\AvalonDock.2.0.2000\lib\net40\Xceed.Wpf.AvalonDock.Themes.VS2010.dll + + .\Xceed.Wpf.AvalonDock.Themes.VS2013.dll + False ..\packages\Extended.Wpf.Toolkit.2.4\lib\net40\Xceed.Wpf.Toolkit.dll diff --git a/Filtration/Repositories/ItemFilterScriptRepository.cs b/Filtration/Repositories/ItemFilterScriptRepository.cs index 9aceccc..2a2af93 100644 --- a/Filtration/Repositories/ItemFilterScriptRepository.cs +++ b/Filtration/Repositories/ItemFilterScriptRepository.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.IO; using Filtration.Models; using Filtration.Services; diff --git a/Filtration/ViewModels/ItemFilterBlockViewModel.cs b/Filtration/ViewModels/ItemFilterBlockViewModel.cs index 41bd4e2..8746c37 100644 --- a/Filtration/ViewModels/ItemFilterBlockViewModel.cs +++ b/Filtration/ViewModels/ItemFilterBlockViewModel.cs @@ -91,7 +91,7 @@ namespace Filtration.ViewModels public ItemFilterBlock Block { get; private set; } public bool IsDirty { get; set; } - public ObservableCollection FilterBlockItems + public ObservableCollection BlockItems { get { return Block.BlockItems; } } @@ -226,7 +226,7 @@ namespace Filtration.ViewModels get { return HasTextColor - ? FilterBlockItems.OfType().First().Color + ? BlockItems.OfType().First().Color : new Color { A = 255, R = 255, G = 255, B = 255 }; } } @@ -241,7 +241,7 @@ namespace Filtration.ViewModels get { return HasBackgroundColor - ? FilterBlockItems.OfType().First().Color + ? BlockItems.OfType().First().Color : new Color { A = 255, R = 0, G = 0, B = 0 }; } } @@ -256,7 +256,7 @@ namespace Filtration.ViewModels get { return HasBorderColor - ? FilterBlockItems.OfType().First().Color + ? BlockItems.OfType().First().Color : new Color { A = 255, R = 0, G = 0, B = 0 }; } } @@ -285,13 +285,13 @@ namespace Filtration.ViewModels if (!AddBlockItemAllowed(blockItemType)) return; var newBlockItem = (IItemFilterBlockItem) Activator.CreateInstance(blockItemType); - FilterBlockItems.Add(newBlockItem); + BlockItems.Add(newBlockItem); IsDirty = true; } private void OnRemoveFilterBlockItemCommand(IItemFilterBlockItem blockItem) { - FilterBlockItems.Remove(blockItem); + BlockItems.Remove(blockItem); IsDirty = true; } @@ -301,7 +301,7 @@ namespace Filtration.ViewModels var newBlockItem = (IItemFilterBlockItem) Activator.CreateInstance(blockItemType); newBlockItem.PropertyChanged += OnAudioVisualBlockItemChanged; - FilterBlockItems.Add(newBlockItem); + BlockItems.Add(newBlockItem); OnAudioVisualBlockItemChanged(null, null); IsDirty = true; } @@ -309,7 +309,7 @@ namespace Filtration.ViewModels private void OnRemoveAudioVisualBlockItemCommand(IItemFilterBlockItem blockItem) { blockItem.PropertyChanged -= OnAudioVisualBlockItemChanged; - FilterBlockItems.Remove(blockItem); + BlockItems.Remove(blockItem); OnAudioVisualBlockItemChanged(null, null); IsDirty = true; } @@ -370,13 +370,13 @@ namespace Filtration.ViewModels private bool AddBlockItemAllowed(Type type) { var blockItem = (IItemFilterBlockItem)Activator.CreateInstance(type); - var blockCount = FilterBlockItems.Count(b => b.GetType() == type); + var blockCount = BlockItems.Count(b => b.GetType() == type); return blockCount < blockItem.MaximumAllowed; } private void OnPlaySoundCommand() { - var soundUri = "Resources/AlertSounds/AlertSound" + FilterBlockItems.OfType().First().Value + ".wav"; + var soundUri = "Resources/AlertSounds/AlertSound" + BlockItems.OfType().First().Value + ".wav"; _mediaPlayer.Open(new Uri(soundUri, UriKind.Relative)); _mediaPlayer.Play(); } diff --git a/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml b/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml index 24f9ab9..104214a 100644 --- a/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml +++ b/Filtration/Views/AvalonDock/AvalonDockWorkspaceView.xaml @@ -71,14 +71,18 @@ + - + - + + + + diff --git a/Filtration/Views/AvalonDock/LayoutInitializer.cs b/Filtration/Views/AvalonDock/LayoutInitializer.cs index 9d36602..2a1b836 100644 --- a/Filtration/Views/AvalonDock/LayoutInitializer.cs +++ b/Filtration/Views/AvalonDock/LayoutInitializer.cs @@ -26,32 +26,19 @@ namespace Filtration.Views.AvalonDock return true; } } - //if (anchorableToShow.ContentId == "SectionBrowserTool") - //{ - // var toolsPane = layout.Descendents().OfType().FirstOrDefault(d => d.Name == "SectionBrowserPane"); - // if (toolsPane != null) - // { - // anchorableToShow.CanHide = false; - // toolsPane.Children.Add(anchorableToShow); - // return true; - // } - //} - - //if (anchorableToShow.ContentId == "BlockGroupBrowserTool") - //{ - // var toolsPane = layout.Descendents().OfType().FirstOrDefault(d => d.Name == "BlockGroupBrowserPane"); - // if (toolsPane != null) - // { - // anchorableToShow.CanHide = false; - // toolsPane.Children.Add(anchorableToShow); - // return true; - // } - //} - + if (anchorableToShow.Content is BlockGroupBrowserViewModel) + { + var toolsPane = layout.Descendents().OfType().FirstOrDefault(d => d.Name == "BlockGroupBrowserPane"); + if (toolsPane != null) + { + anchorableToShow.CanHide = false; + toolsPane.Children.Add(anchorableToShow); + return true; + } + } return false; - } diff --git a/Filtration/Views/ItemFilterBlockView.xaml b/Filtration/Views/ItemFilterBlockView.xaml index d0f2560..3aee75a 100644 --- a/Filtration/Views/ItemFilterBlockView.xaml +++ b/Filtration/Views/ItemFilterBlockView.xaml @@ -38,7 +38,7 @@ Advanced Block Group - + @@ -121,7 +121,7 @@ - + @@ -148,7 +148,7 @@ - + diff --git a/Filtration/Views/ItemFilterBlockView.xaml.cs b/Filtration/Views/ItemFilterBlockView.xaml.cs index 8fbad01..5631e4b 100644 --- a/Filtration/Views/ItemFilterBlockView.xaml.cs +++ b/Filtration/Views/ItemFilterBlockView.xaml.cs @@ -1,4 +1,7 @@ -namespace Filtration.Views +using System.Windows.Controls; +using System.Windows.Input; + +namespace Filtration.Views { public partial class ItemFilterBlockView { @@ -6,5 +9,16 @@ { InitializeComponent(); } + + private void BlockExpander_OnMouseDoubleClick(object sender, MouseButtonEventArgs e) + { + var originalSource = e.OriginalSource as System.Windows.Media.Visual; + if (originalSource != null && originalSource.IsDescendantOf(BlockItemsGrid)) + { + return; + } + + BlockExpander.IsExpanded = !BlockExpander.IsExpanded; + } } } diff --git a/Filtration/Views/ToolPanes/SectionBrowserView.xaml.cs b/Filtration/Views/ToolPanes/SectionBrowserView.xaml.cs new file mode 100644 index 0000000..bd977be --- /dev/null +++ b/Filtration/Views/ToolPanes/SectionBrowserView.xaml.cs @@ -0,0 +1,10 @@ +namespace Filtration.Views.ToolPanes +{ + public partial class SectionBrowserView + { + public SectionBrowserView() + { + InitializeComponent(); + } + } +}