@@ -119,27 +119,27 @@ public bool IsPageMainPane
119
119
}
120
120
}
121
121
122
- public ICommand SelectAllContentPageItemsCommand { get ; private set ; }
122
+ public ICommand SelectAllContentPageItemsCommand => new RelayCommand ( ( ) => SlimContentPage ? . SelectAllItems ( ) ) ;
123
123
124
- public ICommand InvertContentPageSelctionCommand { get ; private set ; }
124
+ public ICommand InvertContentPageSelctionCommand => new RelayCommand ( ( ) => SlimContentPage ? . InvertSelection ( ) ) ;
125
125
126
- public ICommand ClearContentPageSelectionCommand { get ; private set ; }
126
+ public ICommand ClearContentPageSelectionCommand => new RelayCommand ( ( ) => SlimContentPage ? . ClearSelection ( ) ) ;
127
127
128
- public ICommand PasteItemsFromClipboardCommand { get ; private set ; }
128
+ public ICommand PasteItemsFromClipboardCommand => new RelayCommand ( async ( ) => await UIFilesystemHelpers . PasteItemAsync ( FilesystemViewModel . WorkingDirectory , this ) ) ;
129
129
130
- public ICommand CopyPathOfWorkingDirectoryCommand { get ; private set ; }
130
+ public ICommand CopyPathOfWorkingDirectoryCommand => new RelayCommand ( CopyWorkingLocation ) ;
131
131
132
- public ICommand OpenNewWindowCommand { get ; private set ; }
132
+ public ICommand OpenNewWindowCommand => new RelayCommand ( NavigationHelpers . LaunchNewWindow ) ;
133
133
134
- public ICommand OpenNewPaneCommand { get ; private set ; }
134
+ public ICommand OpenNewPaneCommand => new RelayCommand ( ( ) => PaneHolder ? . OpenPathInNewPane ( "NewTab" . GetLocalized ( ) ) ) ;
135
135
136
- public ICommand OpenDirectoryInDefaultTerminalCommand { get ; private set ; }
136
+ public ICommand OpenDirectoryInDefaultTerminalCommand => new RelayCommand ( ( ) => NavigationHelpers . OpenDirectoryInTerminal ( this . FilesystemViewModel . WorkingDirectory , this ) ) ;
137
137
138
- public ICommand AddNewTabToMultitaskingControlCommand { get ; private set ; }
138
+ public ICommand AddNewTabToMultitaskingControlCommand => new RelayCommand ( async ( ) => await MainPageViewModel . AddNewTabByPathAsync ( typeof ( PaneHolderPage ) , "NewTab" . GetLocalized ( ) ) ) ;
139
139
140
- public ICommand CreateNewFileCommand { get ; private set ; }
140
+ public ICommand CreateNewFileCommand => new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . File , null , this ) ) ;
141
141
142
- public ICommand CreateNewFolderCommand { get ; private set ; }
142
+ public ICommand CreateNewFolderCommand => new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . Folder , null , this ) ) ;
143
143
144
144
public static readonly DependencyProperty IsPageMainPaneProperty =
145
145
DependencyProperty . Register ( "IsPageMainPane" , typeof ( bool ) , typeof ( ModernShellPage ) , new PropertyMetadata ( true ) ) ;
@@ -212,25 +212,6 @@ public ModernShellPage()
212
212
AppServiceConnectionHelper . ConnectionChanged += AppServiceConnectionHelper_ConnectionChanged ;
213
213
}
214
214
215
- private void InitializeCommands ( )
216
- {
217
- if ( this . SlimContentPage != null )
218
- {
219
- SelectAllContentPageItemsCommand = new RelayCommand ( this . SlimContentPage . SelectAllItems ) ;
220
- ClearContentPageSelectionCommand = new RelayCommand ( this . SlimContentPage . ClearSelection ) ;
221
- InvertContentPageSelctionCommand = new RelayCommand ( this . SlimContentPage . InvertSelection ) ;
222
- }
223
- PasteItemsFromClipboardCommand = new RelayCommand ( async ( ) => await UIFilesystemHelpers . PasteItemAsync ( FilesystemViewModel . WorkingDirectory , this ) ) ;
224
- CopyPathOfWorkingDirectoryCommand = new RelayCommand ( CopyWorkingLocation ) ;
225
- OpenNewWindowCommand = new RelayCommand ( NavigationHelpers . LaunchNewWindow ) ;
226
- OpenNewPaneCommand = new RelayCommand ( ( ) => PaneHolder ? . OpenPathInNewPane ( "NewTab" . GetLocalized ( ) ) ) ;
227
- OpenDirectoryInDefaultTerminalCommand = new RelayCommand ( ( ) => NavigationHelpers . OpenDirectoryInTerminal ( this . FilesystemViewModel . WorkingDirectory , this ) ) ;
228
- AddNewTabToMultitaskingControlCommand = new RelayCommand ( async ( ) => await MainPageViewModel . AddNewTabByPathAsync ( typeof ( PaneHolderPage ) , "NewTab" . GetLocalized ( ) ) ) ;
229
-
230
- CreateNewFileCommand = new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . File , null , this ) ) ;
231
- CreateNewFolderCommand = new RelayCommand ( ( ) => UIFilesystemHelpers . CreateFileFromDialogResultType ( AddItemType . Folder , null , this ) ) ;
232
- }
233
-
234
215
private void CopyWorkingLocation ( )
235
216
{
236
217
try
@@ -900,7 +881,6 @@ private void ViewModel_WorkingDirectoryModified(object sender, WorkingDirectoryM
900
881
private async void ItemDisplayFrame_Navigated ( object sender , NavigationEventArgs e )
901
882
{
902
883
ContentPage = await GetContentOrNullAsync ( ) ;
903
- InitializeCommands ( ) ;
904
884
NavigationToolbar . ClearSearchBoxQueryText ( true ) ;
905
885
if ( ItemDisplayFrame . CurrentSourcePageType == typeof ( GenericFileBrowser )
906
886
|| ItemDisplayFrame . CurrentSourcePageType == typeof ( GridViewBrowser ) )
0 commit comments