23
23
using Windows . Storage . AccessCache ;
24
24
using Windows . Storage . Pickers ;
25
25
using Windows . System ;
26
+ using Windows . UI . Xaml . Controls ;
26
27
using static Files . Uwp . Helpers . MenuFlyoutHelper ;
27
28
28
29
namespace Files . Uwp . ViewModels . SettingsViewModels
@@ -46,11 +47,16 @@ public class PreferencesViewModel : ObservableObject, IDisposable
46
47
47
48
public ICommand OpenFilesAtStartupCommand { get ; }
48
49
50
+ public ICommand ResetLayoutPreferencesCommand { get ; }
51
+ public ICommand ShowResetLayoutPreferencesTipCommand { get ; }
52
+
49
53
public PreferencesViewModel ( )
50
54
{
51
55
ChangePageCommand = new AsyncRelayCommand ( ChangePage ) ;
52
56
RemovePageCommand = new RelayCommand ( RemovePage ) ;
53
57
AddPageCommand = new RelayCommand < string > ( async ( path ) => await AddPage ( path ) ) ;
58
+ ResetLayoutPreferencesCommand = new RelayCommand ( ResetLayoutPreferences ) ;
59
+ ShowResetLayoutPreferencesTipCommand = new RelayCommand ( ( ) => IsResetLayoutPreferencesTipOpen = true ) ;
54
60
55
61
DefaultLanguages = App . AppSettings . DefaultLanguages ;
56
62
Terminals = App . TerminalController . Model . Terminals ;
@@ -716,6 +722,27 @@ public bool ShowDateColumn
716
722
}
717
723
}
718
724
725
+ private bool isLayoutResetCheckmarkVisible ;
726
+ public bool IsLayoutResetCheckmarkVisible
727
+ {
728
+ get => isLayoutResetCheckmarkVisible ;
729
+ set => SetProperty ( ref isLayoutResetCheckmarkVisible , value ) ;
730
+ }
731
+
732
+ private bool isResetLayoutPreferencesTipOpen ;
733
+ public bool IsResetLayoutPreferencesTipOpen
734
+ {
735
+ get => isResetLayoutPreferencesTipOpen ;
736
+ set => SetProperty ( ref isResetLayoutPreferencesTipOpen , value ) ;
737
+ }
738
+
739
+ public void ResetLayoutPreferences ( )
740
+ {
741
+ FolderSettingsViewModel . DbInstance . ResetAll ( ) ;
742
+ IsResetLayoutPreferencesTipOpen = false ;
743
+ IsLayoutResetCheckmarkVisible = true ;
744
+ }
745
+
719
746
public void Dispose ( )
720
747
{
721
748
if ( ! disposed )
0 commit comments