@@ -25,6 +25,8 @@ namespace Files
25
25
/// </summary>
26
26
public abstract class BaseLayout : Page , INotifyPropertyChanged
27
27
{
28
+ public SelectedItemsPropertiesViewModel SelectedItemsPropertiesViewModel { get ; }
29
+ public DirectoryPropertiesViewModel DirectoryPropertiesViewModel { get ; }
28
30
public bool IsQuickLookEnabled { get ; set ; } = false ;
29
31
30
32
public ItemViewModel AssociatedViewModel = null ;
@@ -49,8 +51,6 @@ internal set
49
51
}
50
52
}
51
53
52
- public SelectedItemsPropertiesViewModel SelectedItemsPropertiesViewModel => App . SelectedItemsPropertiesViewModel ;
53
-
54
54
private List < ListedItem > _SelectedItems = new List < ListedItem > ( ) ;
55
55
56
56
public List < ListedItem > SelectedItems
@@ -99,7 +99,8 @@ public BaseLayout()
99
99
{
100
100
this . Loaded += Page_Loaded ;
101
101
Page_Loaded ( null , null ) ;
102
-
102
+ SelectedItemsPropertiesViewModel = new SelectedItemsPropertiesViewModel ( null ) ;
103
+ DirectoryPropertiesViewModel = new DirectoryPropertiesViewModel ( ) ;
103
104
// QuickLook Integration
104
105
ApplicationDataContainer localSettings = ApplicationData . Current . LocalSettings ;
105
106
var isQuickLookIntegrationEnabled = localSettings . Values [ "quicklook_enabled" ] ;
@@ -140,11 +141,11 @@ private void AppSettings_LayoutModeChangeRequested(object sender, EventArgs e)
140
141
{
141
142
if ( App . CurrentInstance . ContentPage != null )
142
143
{
143
- App . CurrentInstance . ViewModel . CancelLoadAndClearFiles ( ) ;
144
- App . CurrentInstance . ViewModel . IsLoadingItems = true ;
145
- App . CurrentInstance . ViewModel . IsLoadingItems = false ;
144
+ App . CurrentInstance . FilesystemViewModel . CancelLoadAndClearFiles ( ) ;
145
+ App . CurrentInstance . FilesystemViewModel . IsLoadingItems = true ;
146
+ App . CurrentInstance . FilesystemViewModel . IsLoadingItems = false ;
146
147
147
- App . CurrentInstance . ContentFrame . Navigate ( App . AppSettings . GetLayoutType ( ) , App . CurrentInstance . ViewModel . WorkingDirectory , null ) ;
148
+ App . CurrentInstance . ContentFrame . Navigate ( App . AppSettings . GetLayoutType ( ) , App . CurrentInstance . FilesystemViewModel . WorkingDirectory , null ) ;
148
149
}
149
150
}
150
151
@@ -171,23 +172,23 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
171
172
App . CurrentInstance . NavigationToolbar . CanRefresh = true ;
172
173
IsItemSelected = false ;
173
174
AssociatedViewModel . IsFolderEmptyTextDisplayed = false ;
174
- App . CurrentInstance . ViewModel . WorkingDirectory = parameters ;
175
+ App . CurrentInstance . FilesystemViewModel . WorkingDirectory = parameters ;
175
176
176
177
// pathRoot will be empty on recycle bin path
177
- string pathRoot = Path . GetPathRoot ( App . CurrentInstance . ViewModel . WorkingDirectory ) ;
178
- if ( string . IsNullOrEmpty ( pathRoot ) || App . CurrentInstance . ViewModel . WorkingDirectory == pathRoot )
178
+ string pathRoot = Path . GetPathRoot ( App . CurrentInstance . FilesystemViewModel . WorkingDirectory ) ;
179
+ if ( string . IsNullOrEmpty ( pathRoot ) || App . CurrentInstance . FilesystemViewModel . WorkingDirectory == pathRoot )
179
180
{
180
181
App . CurrentInstance . NavigationToolbar . CanNavigateToParent = false ;
181
182
}
182
183
else
183
184
{
184
185
App . CurrentInstance . NavigationToolbar . CanNavigateToParent = true ;
185
186
}
186
- App . InteractionViewModel . IsPageTypeNotHome = true ; // show controls that were hidden on the home page
187
- App . InteractionViewModel . IsPageTypeNotRecycleBin =
188
- ! App . CurrentInstance . ViewModel . WorkingDirectory . StartsWith ( App . AppSettings . RecycleBinPath ) ;
187
+ App . CurrentInstance . InstanceViewModel . IsPageTypeNotHome = true ; // show controls that were hidden on the home page
188
+ App . CurrentInstance . InstanceViewModel . IsPageTypeNotRecycleBin =
189
+ ! App . CurrentInstance . FilesystemViewModel . WorkingDirectory . StartsWith ( App . AppSettings . RecycleBinPath ) ;
189
190
190
- App . CurrentInstance . ViewModel . RefreshItems ( ) ;
191
+ App . CurrentInstance . FilesystemViewModel . RefreshItems ( ) ;
191
192
192
193
App . Clipboard_ContentChanged ( null , null ) ;
193
194
App . CurrentInstance . NavigationToolbar . PathControlDisplayText = parameters ;
@@ -210,7 +211,7 @@ private void UnloadMenuFlyoutItemByName(string nameToUnload)
210
211
211
212
public void RightClickContextMenu_Opening ( object sender , object e )
212
213
{
213
- if ( App . CurrentInstance . ViewModel . WorkingDirectory . StartsWith ( App . AppSettings . RecycleBinPath ) )
214
+ if ( App . CurrentInstance . FilesystemViewModel . WorkingDirectory . StartsWith ( App . AppSettings . RecycleBinPath ) )
214
215
{
215
216
( this . FindName ( "EmptyRecycleBin" ) as MenuFlyoutItemBase ) . Visibility = Visibility . Visible ;
216
217
( this . FindName ( "OpenTerminal" ) as MenuFlyoutItemBase ) . IsEnabled = false ;
@@ -298,7 +299,7 @@ private void Page_Loaded(object sender, RoutedEventArgs e)
298
299
{
299
300
if ( AssociatedViewModel == null && AssociatedInteractions == null )
300
301
{
301
- AssociatedViewModel = App . CurrentInstance . ViewModel ;
302
+ AssociatedViewModel = App . CurrentInstance . FilesystemViewModel ;
302
303
AssociatedInteractions = App . CurrentInstance . InteractionOperations ;
303
304
if ( App . CurrentInstance == null )
304
305
{
@@ -319,7 +320,7 @@ protected async void List_DragOver(object sender, DragEventArgs e)
319
320
{
320
321
IReadOnlyList < IStorageItem > draggedItems = await e . DataView . GetStorageItemsAsync ( ) ;
321
322
// As long as one file doesn't already belong to this folder
322
- if ( draggedItems . Any ( draggedItem => ! Directory . GetParent ( draggedItem . Path ) . FullName . Equals ( App . CurrentInstance . ViewModel . WorkingDirectory , StringComparison . OrdinalIgnoreCase ) ) )
323
+ if ( draggedItems . Any ( draggedItem => ! Directory . GetParent ( draggedItem . Path ) . FullName . Equals ( App . CurrentInstance . FilesystemViewModel . WorkingDirectory , StringComparison . OrdinalIgnoreCase ) ) )
323
324
{
324
325
e . AcceptedOperation = DataPackageOperation . Copy ;
325
326
e . Handled = true ;
@@ -335,7 +336,7 @@ protected async void List_Drop(object sender, DragEventArgs e)
335
336
{
336
337
if ( e . DataView . Contains ( StandardDataFormats . StorageItems ) )
337
338
{
338
- await AssociatedInteractions . PasteItems ( e . DataView , App . CurrentInstance . ViewModel . WorkingDirectory , e . AcceptedOperation ) ;
339
+ await AssociatedInteractions . PasteItems ( e . DataView , App . CurrentInstance . FilesystemViewModel . WorkingDirectory , e . AcceptedOperation ) ;
339
340
e . Handled = true ;
340
341
}
341
342
}
0 commit comments