Skip to content

Commit 56ce6be

Browse files
committed
Chore: Cleanup
1 parent b3775fc commit 56ce6be

File tree

3 files changed

+6
-105
lines changed

3 files changed

+6
-105
lines changed

Source/NETworkManager/ViewModels/ProfilesViewModel.cs

Lines changed: 5 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
using MahApps.Metro.Controls.Dialogs;
2-
using NETworkManager.Profiles;
1+
using NETworkManager.Profiles;
32
using NETworkManager.Settings;
43
using NETworkManager.Utilities;
54
using System;
65
using System.Collections;
76
using System.Collections.Generic;
8-
using System.Collections.ObjectModel;
97
using System.ComponentModel;
108
using System.Linq;
119
using System.Windows;
@@ -19,10 +17,8 @@ public class ProfilesViewModel : ViewModelBase, IProfileManager
1917
{
2018
#region Constructor
2119

22-
public ProfilesViewModel(IDialogCoordinator instance)
20+
public ProfilesViewModel()
2321
{
24-
_dialogCoordinator = instance;
25-
2622
SetGroupsView();
2723

2824
ProfileManager.OnProfilesUpdated += ProfileManager_OnProfilesUpdated;
@@ -34,8 +30,7 @@ public ProfilesViewModel(IDialogCoordinator instance)
3430
#endregion
3531

3632
#region Variables
37-
38-
private readonly IDialogCoordinator _dialogCoordinator;
33+
3934
private readonly DispatcherTimer _searchDispatcherTimer = new();
4035

4136
private bool _isViewActive = true;
@@ -159,69 +154,7 @@ public bool IsSearching
159154
}
160155
}
161156

162-
private bool _profileFilterIsOpen;
163-
164-
public bool ProfileFilterIsOpen
165-
{
166-
get => _profileFilterIsOpen;
167-
set
168-
{
169-
if (value == _profileFilterIsOpen)
170-
return;
171-
172-
_profileFilterIsOpen = value;
173-
OnPropertyChanged();
174-
}
175-
}
176-
177-
public ICollectionView ProfileFilterTagsView { get; set; }
178-
179-
public ObservableCollection<ProfileFilterTagsInfo> ProfileFilterTags { get; set; } = [];
180-
181-
private bool _profileFilterTagsMatchAny = GlobalStaticConfiguration.Profile_TagsMatchAny;
182-
183-
public bool ProfileFilterTagsMatchAny
184-
{
185-
get => _profileFilterTagsMatchAny;
186-
set
187-
{
188-
if (value == _profileFilterTagsMatchAny)
189-
return;
190-
191-
_profileFilterTagsMatchAny = value;
192-
OnPropertyChanged();
193-
}
194-
}
195-
196-
private bool _profileFilterTagsMatchAll;
197-
198-
public bool ProfileFilterTagsMatchAll
199-
{
200-
get => _profileFilterTagsMatchAll;
201-
set
202-
{
203-
if (value == _profileFilterTagsMatchAll)
204-
return;
205-
206-
_profileFilterTagsMatchAll = value;
207-
OnPropertyChanged();
208-
}
209-
}
210-
211-
private bool _isProfileFilterSet;
212-
213-
public bool IsProfileFilterSet
214-
{
215-
get => _isProfileFilterSet;
216-
set
217-
{
218-
if (value == _isProfileFilterSet)
219-
return;
220-
221-
_isProfileFilterSet = value;
222-
OnPropertyChanged();
223-
}
224-
}
157+
225158
#endregion
226159

227160
#region Commands & Actions
@@ -287,37 +220,7 @@ private void DeleteGroupAction()
287220
{
288221
ProfileDialogManager.ShowDeleteGroupDialog(Application.Current.MainWindow, this, SelectedGroup).ConfigureAwait(false);
289222
}
290-
291-
public ICommand OpenProfileFilterCommand => new RelayCommand(_ => OpenProfileFilterAction());
292-
293-
private void OpenProfileFilterAction()
294-
{
295-
ProfileFilterIsOpen = true;
296-
}
297-
298-
public ICommand ApplyProfileFilterCommand => new RelayCommand(_ => ApplyProfileFilterAction());
299-
300-
private void ApplyProfileFilterAction()
301-
{
302-
RefreshProfiles();
303-
304-
IsProfileFilterSet = true;
305-
ProfileFilterIsOpen = false;
306-
}
307-
308-
public ICommand ClearProfileFilterCommand => new RelayCommand(_ => ClearProfileFilterAction());
309-
310-
private void ClearProfileFilterAction()
311-
{
312-
foreach (var tag in ProfileFilterTags)
313-
tag.IsSelected = false;
314-
315-
RefreshProfiles();
316-
317-
IsProfileFilterSet = false;
318-
ProfileFilterIsOpen = false;
319-
}
320-
223+
321224
#endregion
322225

323226
#region Methods

Source/NETworkManager/Views/ProfilesView.xaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,8 @@
99
xmlns:mah="http://metro.mahapps.com/winfx/xaml/controls"
1010
xmlns:viewModels="clr-namespace:NETworkManager.ViewModels"
1111
xmlns:profiles="clr-namespace:NETworkManager.Profiles;assembly=NETworkManager.Profiles"
12-
xmlns:dialogs="clr-namespace:MahApps.Metro.Controls.Dialogs;assembly=MahApps.Metro"
1312
xmlns:localization="clr-namespace:NETworkManager.Localization.Resources;assembly=NETworkManager.Localization"
1413
xmlns:settings="clr-namespace:NETworkManager.Settings;assembly=NETworkManager.Settings"
15-
dialogs:DialogParticipation.Register="{Binding}"
1614
mc:Ignorable="d" d:DataContext="{d:DesignInstance viewModels:ProfilesViewModel}">
1715
<UserControl.Resources>
1816
<converters:BooleanReverseToVisibilityCollapsedConverter x:Key="BooleanReverseToVisibilityCollapsedConverter" />

Source/NETworkManager/Views/ProfilesView.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ namespace NETworkManager.Views;
88

99
public partial class ProfilesView
1010
{
11-
private readonly ProfilesViewModel _viewModel = new(DialogCoordinator.Instance);
11+
private readonly ProfilesViewModel _viewModel = new();
1212

1313
public ProfilesView()
1414
{

0 commit comments

Comments
 (0)