diff --git a/Files/App.xaml.cs b/Files/App.xaml.cs
index 321c4dcaea6a..f7c229a1bb6a 100644
--- a/Files/App.xaml.cs
+++ b/Files/App.xaml.cs
@@ -55,6 +55,7 @@ sealed partial class App : Application
public static DrivesManager DrivesManager { get; private set; }
public static WSLDistroManager WSLDistroManager { get; private set; }
public static LibraryManager LibraryManager { get; private set; }
+ public static ExternalResourcesHelper ExternalResourcesHelper { get; private set; }
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
@@ -89,6 +90,9 @@ private static async Task EnsureSettingsAndConfigurationAreBootstrapped()
AppSettings = await SettingsViewModel.CreateInstance();
}
+ ExternalResourcesHelper ??= new ExternalResourcesHelper();
+ await ExternalResourcesHelper.LoadSelectedTheme();
+
InteractionViewModel ??= new InteractionViewModel();
SidebarPinnedController ??= await SidebarPinnedController.CreateInstance();
LibraryManager ??= new LibraryManager();
diff --git a/Files/Files.csproj b/Files/Files.csproj
index 5288c42bf5db..0b2752c33855 100644
--- a/Files/Files.csproj
+++ b/Files/Files.csproj
@@ -208,6 +208,7 @@
RestartDialog.xaml
+
diff --git a/Files/Helpers/ExternalResourcesHelper.cs b/Files/Helpers/ExternalResourcesHelper.cs
new file mode 100644
index 000000000000..a3a9d5d507da
--- /dev/null
+++ b/Files/Helpers/ExternalResourcesHelper.cs
@@ -0,0 +1,78 @@
+using Microsoft.Toolkit.Uwp.Extensions;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Windows.Storage;
+using Windows.UI.Core;
+using Windows.UI.Xaml;
+using Windows.UI.Xaml.Markup;
+
+namespace Files.Helpers
+{
+ public class ExternalResourcesHelper
+ {
+
+ public List Themes = new List()
+ {
+ "DefaultScheme".GetLocalized()
+ };
+
+ private StorageFolder ThemeFolder { get; set; }
+
+ public string CurrentThemeResources { get; set; }
+
+ public async Task LoadSelectedTheme()
+ {
+ ThemeFolder = (await ApplicationData.Current.LocalFolder.TryGetItemAsync("Themes")) as StorageFolder;
+ ThemeFolder ??= await ApplicationData.Current.LocalFolder.CreateFolderAsync("Themes");
+
+ if (App.AppSettings.PathToThemeFile != "DefaultScheme".GetLocalized())
+ {
+ await TryLoadThemeAsync(App.AppSettings.PathToThemeFile);
+ }
+
+ LoadOtherThemesAsync();
+ }
+
+ private async void LoadOtherThemesAsync()
+ {
+ try
+ {
+ foreach (var file in (await ThemeFolder.GetFilesAsync()).Where(x => x.FileType == ".xaml"))
+ {
+ Themes.Add(file.Name);
+ }
+ }
+ catch (Exception)
+ {
+ Debug.WriteLine($"Error loading themes");
+ }
+ }
+
+ public async Task TryLoadThemeAsync(string name)
+ {
+ try
+ {
+ var file = await ThemeFolder.GetFileAsync(name);
+ CurrentThemeResources = await FileIO.ReadTextAsync(file);
+ var xaml = XamlReader.Load(CurrentThemeResources) as ResourceDictionary;
+ App.Current.Resources.MergedDictionaries.Add(xaml);
+
+ return true;
+ }
+ catch (Exception)
+ {
+ return false;
+ }
+ }
+
+ public struct AppTheme
+ {
+ public ResourceDictionary ResourceDictionary { get; set; }
+ public string Name { get; set; }
+ }
+ }
+}
diff --git a/Files/Interacts/Interaction.cs b/Files/Interacts/Interaction.cs
index 9ec88f3afe1f..15e9533f48ee 100644
--- a/Files/Interacts/Interaction.cs
+++ b/Files/Interacts/Interaction.cs
@@ -832,6 +832,7 @@ await newWindow.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () =>
Window.Current.Close();
};
});
+
bool viewShown = await ApplicationViewSwitcher.TryShowAsStandaloneAsync(newView.Id);
// Set window size again here as sometimes it's not resized in the page Loaded event
newView.TryResizeView(new Size(400, 550));
diff --git a/Files/MultilingualResources/Files.ar.xlf b/Files/MultilingualResources/Files.ar.xlf
index 1212f46d2d1e..14c76fa5021c 100644
--- a/Files/MultilingualResources/Files.ar.xlf
+++ b/Files/MultilingualResources/Files.ar.xlf
@@ -2394,6 +2394,14 @@
Open in new Pane
Open in new Pane
+
+ Default
+ Default
+
+