Skip to content

Commit 4ee9f03

Browse files
committed
Fix double loading of items upon layout change
1 parent 035b9ae commit 4ee9f03

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Files/BaseLayout.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,6 @@ public ListedItem SelectedItem
9999
public BaseLayout()
100100
{
101101
this.Loaded += Page_Loaded;
102-
App.AppSettings.LayoutModeChangeRequested += AppSettings_LayoutModeChangeRequested;
103102
Page_Loaded(null, null);
104103

105104
// QuickLook Integration
@@ -114,7 +113,7 @@ public BaseLayout()
114113

115114
private void AppSettings_LayoutModeChangeRequested(object sender, EventArgs e)
116115
{
117-
if(App.CurrentInstance.ContentPage != null)
116+
if (App.CurrentInstance.ContentPage != null)
118117
{
119118
App.CurrentInstance.ViewModel.CancelLoadAndClearFiles();
120119
if (App.AppSettings.LayoutMode == 0)
@@ -140,6 +139,7 @@ protected override void OnNavigatedTo(NavigationEventArgs eventArgs)
140139
{
141140
base.OnNavigatedTo(eventArgs);
142141
// Add item jumping handler
142+
App.AppSettings.LayoutModeChangeRequested += AppSettings_LayoutModeChangeRequested;
143143
Window.Current.CoreWindow.CharacterReceived += Page_CharacterReceived;
144144
var parameters = (string)eventArgs.Parameter;
145145
if (App.AppSettings.FormFactor == Enums.FormFactorMode.Regular)
@@ -177,6 +177,7 @@ protected override void OnNavigatingFrom(NavigatingCancelEventArgs e)
177177
{
178178
App.CurrentInstance.ViewModel._fileQueryResult.ContentsChanged -= App.CurrentInstance.ViewModel.FileContentsChanged;
179179
}
180+
App.AppSettings.LayoutModeChangeRequested -= AppSettings_LayoutModeChangeRequested;
180181
}
181182

182183
private void UnloadMenuFlyoutItemByName(string nameToUnload)

0 commit comments

Comments
 (0)