|
@@ -1,49 +1,11 @@
|
|
|
using Avalonia;
|
|
using Avalonia;
|
|
|
using Avalonia.Media;
|
|
using Avalonia.Media;
|
|
|
-using Avalonia.Styling;
|
|
|
|
|
using PicView.Avalonia.ViewModels;
|
|
using PicView.Avalonia.ViewModels;
|
|
|
using PicView.Core.Config;
|
|
using PicView.Core.Config;
|
|
|
|
|
|
|
|
namespace PicView.Avalonia.UI;
|
|
namespace PicView.Avalonia.UI;
|
|
|
-public static class ThemeHelper
|
|
|
|
|
|
|
+public static class BackgroundManager
|
|
|
{
|
|
{
|
|
|
- #region Change Theme
|
|
|
|
|
-
|
|
|
|
|
- // TODO: Implement changing Dark/Light theme
|
|
|
|
|
- public static void ChangeTheme()
|
|
|
|
|
- {
|
|
|
|
|
- var application = Application.Current;
|
|
|
|
|
- if (application is null)
|
|
|
|
|
- return;
|
|
|
|
|
-
|
|
|
|
|
- var styles = application.Styles;
|
|
|
|
|
- styles.Clear();
|
|
|
|
|
-
|
|
|
|
|
- if (SettingsHelper.Settings.Theme.Dark)
|
|
|
|
|
- {
|
|
|
|
|
- // Change to light theme
|
|
|
|
|
- styles.Add(new Styles
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- SettingsHelper.Settings.Theme.Dark = false;
|
|
|
|
|
- application.RequestedThemeVariant = ThemeVariant.Light;
|
|
|
|
|
- }
|
|
|
|
|
- else
|
|
|
|
|
- {
|
|
|
|
|
- // Change to dark theme
|
|
|
|
|
- styles.Add(new Styles
|
|
|
|
|
- {
|
|
|
|
|
-
|
|
|
|
|
- });
|
|
|
|
|
- SettingsHelper.Settings.Theme.Dark = true;
|
|
|
|
|
- application.RequestedThemeVariant = ThemeVariant.Dark;
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- #endregion
|
|
|
|
|
- #region Background
|
|
|
|
|
-
|
|
|
|
|
public static void ChangeBackground(MainViewModel vm)
|
|
public static void ChangeBackground(MainViewModel vm)
|
|
|
{
|
|
{
|
|
|
if (vm.ImageSource is null)
|
|
if (vm.ImageSource is null)
|
|
@@ -125,8 +87,4 @@ public static class ThemeHelper
|
|
|
|
|
|
|
|
return checkerboardBrush;
|
|
return checkerboardBrush;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- #endregion
|
|
|
|
|
-
|
|
|
|
|
-
|
|
|
|
|
}
|
|
}
|