diff --git a/src/MSDIAL5/MsdialGuiApp/Model/Search/KeywordFilterModel.cs b/src/MSDIAL5/MsdialGuiApp/Model/Search/KeywordFilterModel.cs index 5f6d9799f..c9d0977f0 100644 --- a/src/MSDIAL5/MsdialGuiApp/Model/Search/KeywordFilterModel.cs +++ b/src/MSDIAL5/MsdialGuiApp/Model/Search/KeywordFilterModel.cs @@ -23,7 +23,7 @@ public sealed class KeywordFilterModel : DisposableModelBase public KeywordFilterModel(string label, KeywordFilteringType type = KeywordFilteringType.IgnoreIfWordIsNull) { _sem = new SemaphoreSlim(1, 1).AddTo(Disposables); - _keywords = new List(); + _keywords = []; Keywords = _keywords.AsReadOnly(); switch (type) { case KeywordFilteringType.ExactMatch: @@ -33,6 +33,7 @@ public KeywordFilterModel(string label, KeywordFilteringType type = KeywordFilte _method = new KeepIfWordIsNull(); break; case KeywordFilteringType.IgnoreIfWordIsNull: + case KeywordFilteringType.None: default: _method = new IgnoreIfWordIsNull(); break; @@ -56,10 +57,21 @@ public async Task SetKeywordsAsync(IEnumerable keywords, CancellationTok } } +public void ClearKeywords() { + _sem.Wait(); + try { + SetKeywords([]); + } + finally { + _sem.Release(); + } +} + private void SetKeywords(IEnumerable keywords) { _keywords.Clear(); _keywords.AddRange(keywords); IsEnabled = _keywords.Count > 0; + OnPropertyChanged(nameof(Keywords)); } public bool Match(string word) { diff --git a/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotNavigatorModel.cs b/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotNavigatorModel.cs index 491cd1193..781c7a6c5 100644 --- a/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotNavigatorModel.cs +++ b/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotNavigatorModel.cs @@ -46,6 +46,20 @@ public string? SelectedAnnotationLabel { public PeakSpotTagSearchQueryBuilderModel TagSearchQueryBuilder { get; } public ObservableCollection PeakFilters { get; } = new ObservableCollection(); + public void ResetFilters() { + foreach (var peakFilterModel in PeakFilters) { + peakFilterModel.CheckedFilter = DisplayFilter.Unset; + } + AmplitudeFilterModel.Reset(); + foreach (var valueFilterModel in ValueFilterModels) { + valueFilterModel.Reset(); + } + foreach (var keywordFilterModel in KeywordFilterModels) { + keywordFilterModel.ClearKeywords(); + } + TagSearchQueryBuilder.Reset(); + } + public void RefreshCollectionViews() { foreach (var view in PeakSpotsCollection) { view.Refresh(); diff --git a/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotTagSearchQueryBuilderModel.cs b/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotTagSearchQueryBuilderModel.cs index 834ca5a0d..994d49736 100644 --- a/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotTagSearchQueryBuilderModel.cs +++ b/src/MSDIAL5/MsdialGuiApp/Model/Search/PeakSpotTagSearchQueryBuilderModel.cs @@ -42,6 +42,15 @@ public bool Excludes { } private bool _excludes; + public void Reset() { + Confirmed = false; + LowQualitySpectrum = false; + Misannotation = false; + Coelution = false; + Overannotation = false; + Excludes = false; + } + public PeakSpotTagSearchQuery CreateQuery() { var tags = new List(); if (Confirmed) { diff --git a/src/MSDIAL5/MsdialGuiApp/Model/Search/ValueFilterModel.cs b/src/MSDIAL5/MsdialGuiApp/Model/Search/ValueFilterModel.cs index 307591f02..1c4249b0d 100644 --- a/src/MSDIAL5/MsdialGuiApp/Model/Search/ValueFilterModel.cs +++ b/src/MSDIAL5/MsdialGuiApp/Model/Search/ValueFilterModel.cs @@ -58,6 +58,12 @@ public bool Contains(double value) { return Lower <= value && value <= Upper; } + public void Reset() { + Lower = Minimum; + Upper = Maximum; + IsEnabled = false; + } + public bool IsEnabled { get => _isEnabled; set => SetProperty(ref _isEnabled, value); diff --git a/src/MSDIAL5/MsdialGuiApp/View/Dims/DimsAlignmentSpotTableView.xaml b/src/MSDIAL5/MsdialGuiApp/View/Dims/DimsAlignmentSpotTableView.xaml index df3fcc0a1..a40e95883 100644 --- a/src/MSDIAL5/MsdialGuiApp/View/Dims/DimsAlignmentSpotTableView.xaml +++ b/src/MSDIAL5/MsdialGuiApp/View/Dims/DimsAlignmentSpotTableView.xaml @@ -86,8 +86,42 @@ - + + + + @@ -127,6 +161,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -128,6 +162,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -127,6 +161,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -127,6 +161,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -127,6 +161,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -127,6 +161,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -123,6 +157,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -123,6 +157,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -127,6 +161,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> + + @@ -128,6 +162,11 @@ Margin="8,0" VerticalAlignment="Center" HorizontalAlignment="Left" Width="128"/> +