diff --git a/Filtration.ItemFilterPreview.Tests/app.config b/Filtration.ItemFilterPreview.Tests/app.config index c486a0d..8ba7191 100644 --- a/Filtration.ItemFilterPreview.Tests/app.config +++ b/Filtration.ItemFilterPreview.Tests/app.config @@ -1,39 +1,39 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Filtration.Tests/app.config b/Filtration.Tests/app.config index dcaf02c..c7c66cc 100644 --- a/Filtration.Tests/app.config +++ b/Filtration.Tests/app.config @@ -1,43 +1,43 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Filtration/App.config b/Filtration/App.config index 79a6b82..6ab6fc5 100644 --- a/Filtration/App.config +++ b/Filtration/App.config @@ -1,95 +1,95 @@ - - - - -
- - -
- - - - - - - - - - - - True - - - 0 - - - False - - - 0 - - - 2016-01-01 - - - False - - - True - - - True - - - True - - - False - - - Normal - - - 1200 - - - 800 - - - - - - True - - - - - - - - - - - - - - - - - - - - - - - http://ben-wallis.github.io/Filtration/ItemBaseTypes.txt - - - http://ben-wallis.github.io/Filtration/ItemClasses.txt - - - http://ben-wallis.github.io/Filtration/filtration_version.xml - - - - + + + + +
+ + +
+ + + + + + + + + + + + True + + + 0 + + + False + + + 0 + + + 2016-01-01 + + + False + + + True + + + True + + + True + + + False + + + Normal + + + 1200 + + + 800 + + + + + + True + + + + + + + + + + + + + + + + + + + + + + + http://ben-wallis.github.io/Filtration/ItemBaseTypes.txt + + + http://ben-wallis.github.io/Filtration/ItemClasses.txt + + + http://ben-wallis.github.io/Filtration/filtration_version.xml + + + + diff --git a/Filtration/Filtration.csproj b/Filtration/Filtration.csproj index f6cb9e6..24ba2cd 100644 --- a/Filtration/Filtration.csproj +++ b/Filtration/Filtration.csproj @@ -76,6 +76,9 @@ ..\packages\DeltaCompressionDotNet.1.1.0\lib\net20\DeltaCompressionDotNet.PatchApi.dll + + ..\packages\DynamicData.6.7.0.2529\lib\net46\DynamicData.dll + ..\packages\Fluent.Ribbon.6.1.0.326\lib\net45\Fluent.dll @@ -130,6 +133,9 @@ + + ..\packages\System.Reactive.4.0.0\lib\net46\System.Reactive.dll + @@ -138,6 +144,7 @@ ..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll + False ..\packages\WPFToolkit.3.5.50211.1\lib\System.Windows.Controls.Input.Toolkit.dll diff --git a/Filtration/ViewModels/ItemFilterScriptViewModel.cs b/Filtration/ViewModels/ItemFilterScriptViewModel.cs index 60a54d3..1d9e847 100644 --- a/Filtration/ViewModels/ItemFilterScriptViewModel.cs +++ b/Filtration/ViewModels/ItemFilterScriptViewModel.cs @@ -6,11 +6,13 @@ using System.ComponentModel; using System.Diagnostics; using System.IO; using System.Linq; +using System.Reactive.Linq; using System.Threading.Tasks; using System.Windows; using System.Windows.Data; using System.Windows.Forms; using System.Windows.Media.Imaging; +using DynamicData.Binding; using Filtration.Common.Services; using Filtration.Common.ViewModels; using Filtration.Interface; @@ -111,6 +113,7 @@ namespace Filtration.ViewModels private Predicate _blockFilterPredicate; private ICommandManager _scriptCommandManager; + private List _subscriptions; private ObservableCollection _customSoundsAvailable; private readonly List _lastAddedBlocks; @@ -130,14 +133,20 @@ namespace Filtration.ViewModels _persistenceService = persistenceService; _messageBoxService = messageBoxService; _clipboardService = clipboardService; + _subscriptions = new List(); ItemFilterBlockViewModels = new ObservableCollection(); SelectedBlockViewModels = new ObservableCollection(); - SelectedBlockViewModels.CollectionChanged += (s, e) => - { - RaisePropertyChanged(nameof(SelectedBlockViewModels)); - RaisePropertyChanged(nameof(LastSelectedBlockViewModel)); - Messenger.Default.Send(new NotificationMessage("LastSelectedBlockChanged")); - }; + + _subscriptions.Add( + SelectedBlockViewModels.ToObservableChangeSet() + .Throttle(TimeSpan.FromMilliseconds(30)) + .Subscribe(x => { + RaisePropertyChanged(nameof(SelectedBlockViewModels)); + RaisePropertyChanged(nameof(LastSelectedBlockViewModel)); + Messenger.Default.Send(new NotificationMessage("LastSelectedBlockChanged")); + }) + ); + _lastAddedBlocks = new List(); _showAdvanced = Settings.Default.ShowAdvanced; @@ -815,6 +824,13 @@ namespace Filtration.ViewModels private void CloseScript() { + foreach (var disposable in Enumerable.Reverse(_subscriptions)) + { + disposable.Dispose(); + } + + _subscriptions.Clear(); + var openMasterThemForScript = _avalonDockWorkspaceViewModel.OpenMasterThemeForScript(this); if (openMasterThemForScript != null) diff --git a/Filtration/packages.config b/Filtration/packages.config index 483d44a..8428a6f 100644 --- a/Filtration/packages.config +++ b/Filtration/packages.config @@ -1,25 +1,27 @@ - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file