Browse Source

Refactor rename

Ruben 1 year ago
parent
commit
f3111f2337

+ 1 - 43
src/PicView.Avalonia/UI/ThemeHelper.cs → src/PicView.Avalonia/UI/BackgroundManager.cs

@@ -1,49 +1,11 @@
 using Avalonia;
 using Avalonia.Media;
-using Avalonia.Styling;
 using PicView.Avalonia.ViewModels;
 using PicView.Core.Config;
 
 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)
     {
         if (vm.ImageSource is null)
@@ -125,8 +87,4 @@ public static class ThemeHelper
 
         return checkerboardBrush;
     }
-    
-    #endregion
-
-    
 }

+ 1 - 1
src/PicView.Avalonia/UI/FunctionsHelper.cs

@@ -692,7 +692,7 @@ public static class FunctionsHelper
             return;
         }
         
-        ThemeHelper.ChangeBackground(Vm);
+        BackgroundManager.ChangeBackground(Vm);
         await SettingsHelper.SaveSettingsAsync();
     }
     

+ 1 - 1
src/PicView.Avalonia/UI/StartUpHelper.cs

@@ -146,7 +146,7 @@ public static class StartUpHelper
             }
         }
         
-        ThemeHelper.SetBackground(vm);
+        BackgroundManager.SetBackground(vm);
         
         Task.Run(KeybindingsHelper.LoadKeybindings);
         

+ 39 - 0
src/PicView.Avalonia/UI/ThemeManager.cs

@@ -0,0 +1,39 @@
+using Avalonia;
+using Avalonia.Styling;
+using PicView.Core.Config;
+
+namespace PicView.Avalonia.UI;
+public static class ThemeManager
+{
+    // 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;
+        }
+    }
+}