Skip to content

Commit 762d205

Browse files
committed
WIP: Refresh-in-place for layout modes
1 parent d6504f7 commit 762d205

File tree

5 files changed

+25
-8
lines changed

5 files changed

+25
-8
lines changed

Files/BaseLayout.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ public ListedItem SelectedItem
9999
public BaseLayout()
100100
{
101101
this.Loaded += Page_Loaded;
102+
App.AppSettings.LayoutModeChangeRequested += AppSettings_LayoutModeChangeRequested;
102103
Page_Loaded(null, null);
103104

104105
// QuickLook Integration
@@ -111,12 +112,30 @@ public BaseLayout()
111112
}
112113
}
113114

115+
private void AppSettings_LayoutModeChangeRequested(object sender, EventArgs e)
116+
{
117+
if(App.CurrentInstance.ContentPage != null)
118+
{
119+
App.CurrentInstance.ViewModel.CancelLoadAndClearFiles();
120+
if (App.AppSettings.LayoutMode == 0)
121+
{
122+
App.CurrentInstance.ContentFrame.Navigate(typeof(GenericFileBrowser), App.CurrentInstance.ViewModel.Universal.WorkingDirectory, null);
123+
}
124+
else
125+
{
126+
App.CurrentInstance.ContentFrame.Navigate(typeof(PhotoAlbum), App.CurrentInstance.ViewModel.Universal.WorkingDirectory, null);
127+
}
128+
App.CurrentInstance.ViewModel.isLoadingItems = false;
129+
}
130+
131+
}
132+
114133
public event PropertyChangedEventHandler PropertyChanged;
115134
private void NotifyPropertyChanged([CallerMemberName] string propertyName = "")
116135
{
117136
PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
118137
}
119-
138+
private bool isStale = false;
120139
protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
121140
{
122141
base.OnNavigatedTo(eventArgs);

Files/View Models/SettingsViewModel.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -522,20 +522,20 @@ public string ToggleLayoutModeIcon
522522
get => Get(""); // List View;
523523
set => Set(value);
524524
}
525-
525+
public event EventHandler LayoutModeChangeRequested;
526526
private RelayCommand toggleLayoutMode;
527527
public RelayCommand ToggleLayoutMode => toggleLayoutMode = new RelayCommand(() =>
528528
{
529529
if (LayoutMode == 0) // List View
530530
{
531531
LayoutMode = 1; // Grid View
532-
532+
LayoutModeChangeRequested?.Invoke(this, EventArgs.Empty);
533533
ToggleLayoutModeIcon = "";
534534
}
535535
else //Grid View
536536
{
537537
LayoutMode = 0; // List View
538-
538+
LayoutModeChangeRequested?.Invoke(this, EventArgs.Empty);
539539
ToggleLayoutModeIcon = "";
540540
}
541541
});

Files/Views/InstanceTabsView.xaml.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717

1818
namespace Files
1919
{
20-
/// <summary>
21-
/// The Instance Tabs Component for Project Mumbai
22-
/// </summary>
2320
public sealed partial class InstanceTabsView : Page
2421
{
2522
public static TabView tabView;

Files/Views/Pages/ModernShellPage.xaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
1313
KeyUp="ModernShellPage_KeyUp"
1414
Loaded="Page_Loaded"
15-
NavigationCacheMode="Disabled"
15+
NavigationCacheMode="Required"
1616
mc:Ignorable="d">
1717

1818
<Grid>

Files/Views/Pages/ModernShellPage.xaml.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,7 @@ private void ItemDisplayFrame_Navigated(object sender, NavigationEventArgs e)
152152
}
153153
}
154154
}
155+
155156
//RibbonArea.Focus(FocusState.Programmatic);
156157
}
157158

0 commit comments

Comments
 (0)