@@ -24,7 +24,6 @@ public class WakeOnLANViewModel : ViewModelBase, IProfileManager
2424{
2525 #region Variables
2626
27- private readonly IDialogCoordinator _dialogCoordinator ;
2827 private readonly DispatcherTimer _searchDispatcherTimer = new ( ) ;
2928
3029 private readonly bool _isLoading ;
@@ -245,7 +244,7 @@ public bool IsProfileFilterSet
245244 OnPropertyChanged ( ) ;
246245 }
247246 }
248-
247+
249248 private bool _canProfileWidthChange = true ;
250249 private double _tempProfileWidth ;
251250
@@ -300,12 +299,10 @@ public GridLength ProfileWidth
300299
301300 #region Constructor, load settings
302301
303- public WakeOnLANViewModel ( IDialogCoordinator instance )
302+ public WakeOnLANViewModel ( )
304303 {
305304 _isLoading = true ;
306305
307- _dialogCoordinator = instance ;
308-
309306 MACAddressHistoryView =
310307 CollectionViewSource . GetDefaultView ( SettingsManager . Current . WakeOnLan_MACAddressHistory ) ;
311308 BroadcastHistoryView = CollectionViewSource . GetDefaultView ( SettingsManager . Current . WakeOnLan_BroadcastHistory ) ;
@@ -314,7 +311,8 @@ public WakeOnLANViewModel(IDialogCoordinator instance)
314311 CreateTags ( ) ;
315312
316313 ProfileFilterTagsView = CollectionViewSource . GetDefaultView ( ProfileFilterTags ) ;
317- ProfileFilterTagsView . SortDescriptions . Add ( new SortDescription ( nameof ( ProfileFilterTagsInfo . Name ) , ListSortDirection . Ascending ) ) ;
314+ ProfileFilterTagsView . SortDescriptions . Add ( new SortDescription ( nameof ( ProfileFilterTagsInfo . Name ) ,
315+ ListSortDirection . Ascending ) ) ;
318316
319317 SetProfilesView ( new ProfileFilterInfo ( ) ) ;
320318
@@ -378,7 +376,8 @@ private void WakeUpProfileAction()
378376
379377 private void AddProfileAction ( )
380378 {
381- ProfileDialogManager . ShowAddProfileDialog ( Application . Current . MainWindow , this , null , null , ApplicationName . WakeOnLAN )
379+ ProfileDialogManager
380+ . ShowAddProfileDialog ( Application . Current . MainWindow , this , null , null , ApplicationName . WakeOnLAN )
382381 . ConfigureAwait ( false ) ;
383382 }
384383
@@ -391,14 +390,16 @@ private bool ModifyProfile_CanExecute(object obj)
391390
392391 private void EditProfileAction ( )
393392 {
394- ProfileDialogManager . ShowEditProfileDialog ( Application . Current . MainWindow , this , SelectedProfile ) . ConfigureAwait ( false ) ;
393+ ProfileDialogManager . ShowEditProfileDialog ( Application . Current . MainWindow , this , SelectedProfile )
394+ . ConfigureAwait ( false ) ;
395395 }
396396
397397 public ICommand CopyAsProfileCommand => new RelayCommand ( _ => CopyAsProfileAction ( ) , ModifyProfile_CanExecute ) ;
398398
399399 private void CopyAsProfileAction ( )
400400 {
401- ProfileDialogManager . ShowCopyAsProfileDialog ( Application . Current . MainWindow , this , SelectedProfile ) . ConfigureAwait ( false ) ;
401+ ProfileDialogManager . ShowCopyAsProfileDialog ( Application . Current . MainWindow , this , SelectedProfile )
402+ . ConfigureAwait ( false ) ;
402403 }
403404
404405 public ICommand DeleteProfileCommand => new RelayCommand ( _ => DeleteProfileAction ( ) , ModifyProfile_CanExecute ) ;
@@ -414,7 +415,8 @@ private void DeleteProfileAction()
414415
415416 private void EditGroupAction ( object group )
416417 {
417- ProfileDialogManager . ShowEditGroupDialog ( Application . Current . MainWindow , this , ProfileManager . GetGroupByName ( $ "{ group } ") )
418+ ProfileDialogManager
419+ . ShowEditGroupDialog ( Application . Current . MainWindow , this , ProfileManager . GetGroupByName ( $ "{ group } ") )
418420 . ConfigureAwait ( false ) ;
419421 }
420422
@@ -424,7 +426,7 @@ private void ClearSearchAction()
424426 {
425427 Search = string . Empty ;
426428 }
427-
429+
428430 public ICommand OpenProfileFilterCommand => new RelayCommand ( _ => OpenProfileFilterAction ( ) ) ;
429431
430432 private void OpenProfileFilterAction ( )
@@ -554,7 +556,8 @@ public void OnViewHide()
554556
555557 private void CreateTags ( )
556558 {
557- var tags = ProfileManager . Groups . SelectMany ( x => x . Profiles ) . Where ( x => x . WakeOnLAN_Enabled ) . SelectMany ( x => x . TagsCollection ) . Distinct ( ) . ToList ( ) ;
559+ var tags = ProfileManager . Groups . SelectMany ( x => x . Profiles ) . Where ( x => x . WakeOnLAN_Enabled )
560+ . SelectMany ( x => x . TagsCollection ) . Distinct ( ) . ToList ( ) ;
558561
559562 var tagSet = new HashSet < string > ( tags ) ;
560563
@@ -571,19 +574,23 @@ private void CreateTags()
571574 ProfileFilterTags . Add ( new ProfileFilterTagsInfo ( false , tag ) ) ;
572575 }
573576 }
574-
577+
575578 private void SetProfilesView ( ProfileFilterInfo filter , ProfileInfo profile = null )
576579 {
577580 Profiles = new CollectionViewSource
578581 {
579582 Source = ProfileManager . Groups . SelectMany ( x => x . Profiles ) . Where ( x => x . WakeOnLAN_Enabled && (
580- string . IsNullOrEmpty ( filter . Search ) || x . Name . IndexOf ( filter . Search , StringComparison . Ordinal ) > - 1 || x . WakeOnLAN_MACAddress . IndexOf ( filter . Search , StringComparison . Ordinal ) > - 1 ) && (
583+ string . IsNullOrEmpty ( filter . Search ) ||
584+ x . Name . IndexOf ( filter . Search , StringComparison . Ordinal ) > - 1 ||
585+ x . WakeOnLAN_MACAddress . IndexOf ( filter . Search , StringComparison . Ordinal ) > - 1 ) && (
581586 // If no tags are selected, show all profiles
582587 ( ! filter . Tags . Any ( ) ) ||
583588 // Any tag can match
584- ( filter . TagsFilterMatch == ProfileFilterTagsMatch . Any && filter . Tags . Any ( tag => x . TagsCollection . Contains ( tag ) ) ) ||
589+ ( filter . TagsFilterMatch == ProfileFilterTagsMatch . Any &&
590+ filter . Tags . Any ( tag => x . TagsCollection . Contains ( tag ) ) ) ||
585591 // All tags must match
586- ( filter . TagsFilterMatch == ProfileFilterTagsMatch . All && filter . Tags . All ( tag => x . TagsCollection . Contains ( tag ) ) ) )
592+ ( filter . TagsFilterMatch == ProfileFilterTagsMatch . All &&
593+ filter . Tags . All ( tag => x . TagsCollection . Contains ( tag ) ) ) )
587594 ) . OrderBy ( x => x . Group ) . ThenBy ( x => x . Name )
588595 } . View ;
589596
@@ -619,7 +626,7 @@ private void RefreshProfiles()
619626 private void ProfileManager_OnProfilesUpdated ( object sender , EventArgs e )
620627 {
621628 CreateTags ( ) ;
622-
629+
623630 RefreshProfiles ( ) ;
624631 }
625632
0 commit comments