Skip to content

Commit 3fcf87c

Browse files
author
Yair Aichenbaum
committed
Fixed app not detecting the system theme the first time launched
1 parent 722f9ef commit 3fcf87c

File tree

1 file changed

+16
-15
lines changed

1 file changed

+16
-15
lines changed

Files UWP/App.xaml.cs

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,19 @@
1616
namespace Files
1717
{
1818
sealed partial class App : Application
19-
{
19+
{
2020
public App()
2121
{
2222
this.InitializeComponent();
2323
this.Suspending += OnSuspending;
2424
this.UnhandledException += App_UnhandledException;
2525
Windows.Storage.ApplicationDataContainer localSettings = Windows.Storage.ApplicationData.Current.LocalSettings;
2626

27+
if (localSettings.Values["theme"] == null)
28+
{
29+
localSettings.Values["theme"] = "Default";
30+
}
31+
2732
if (localSettings.Values["theme"] != null)
2833
{
2934
if (localSettings.Values["theme"].ToString() == "Light")
@@ -53,21 +58,17 @@ public App()
5358
}
5459
}
5560
}
56-
else
57-
{
58-
localSettings.Values["theme"] = "Default";
59-
}
6061

6162
this.RequestedTheme = SettingsPages.Personalization.TV.ThemeValue;
6263
Debug.WriteLine("!!Requested Theme!!" + RequestedTheme.ToString());
6364

64-
65+
6566

6667
}
6768

6869
private void App_UnhandledException(object sender, Windows.UI.Xaml.UnhandledExceptionEventArgs e)
6970
{
70-
e.Handled = true;
71+
e.Handled = true;
7172
Frame rootFrame = Window.Current.Content as Frame;
7273
rootFrame.Navigate(typeof(UnhandledExceptionDisplay), e.Exception);
7374
}
@@ -111,17 +112,17 @@ protected override void OnLaunched(LaunchActivatedEventArgs e)
111112

112113
if (rootFrame.Content == null)
113114
{
114-
115-
// When the navigation stack isn't restored navigate to the first page,
116-
// configuring the new page by passing required information as a navigation
117-
// parameter
118-
rootFrame.Navigate(typeof(InstanceTabsView), e.Arguments, new SuppressNavigationTransitionInfo());
119-
120-
115+
116+
// When the navigation stack isn't restored navigate to the first page,
117+
// configuring the new page by passing required information as a navigation
118+
// parameter
119+
rootFrame.Navigate(typeof(InstanceTabsView), e.Arguments, new SuppressNavigationTransitionInfo());
120+
121+
121122
}
122123
// Ensure the current window is active
123124
Window.Current.Activate();
124-
125+
125126
}
126127
}
127128

0 commit comments

Comments
 (0)