Equbuxu 4 years ago
parent
commit
da36473f15
2 changed files with 37 additions and 16 deletions
  1. 34 0
      PixiEditor/Views/ColorPanelController.cs
  2. 3 16
      PixiEditor/Views/MainWindow.xaml.cs

+ 34 - 0
PixiEditor/Views/ColorPanelController.cs

@@ -0,0 +1,34 @@
+using AvalonDock.Layout;
+using System.Windows;
+
+namespace PixiEditor.Views
+{
+    internal class ColorPanelController
+    {
+        private LayoutAnchorable colorPickerPanel;
+        private LayoutAnchorable colorSlidersPanel;
+        private LayoutAnchorable smallColorPickerPanel;
+
+        public ColorPanelController(LayoutAnchorable colorPickerPanel, LayoutAnchorable colorSlidersPanel, LayoutAnchorable smallColorPickerPanel)
+        {
+            this.colorPickerPanel = colorPickerPanel;
+            this.colorSlidersPanel = colorSlidersPanel;
+            this.smallColorPickerPanel = smallColorPickerPanel;
+        }
+
+        public void DeterminePanelsToDisplay()
+        {
+            if (SystemParameters.PrimaryScreenHeight < 1010)
+            {
+                colorPickerPanel.IsVisible = false;
+                colorSlidersPanel.IsVisible = true;
+                smallColorPickerPanel.IsVisible = true;
+            }
+            else
+            {
+                colorSlidersPanel.IsVisible = false;
+                smallColorPickerPanel.IsVisible = false;
+            }
+        }
+    }
+}

+ 3 - 16
PixiEditor/Views/MainWindow.xaml.cs

@@ -1,6 +1,7 @@
 using Microsoft.Extensions.DependencyInjection;
 using PixiEditor.Models.UserPreferences;
 using PixiEditor.ViewModels;
+using PixiEditor.Views;
 using System;
 using System.ComponentModel;
 using System.Windows;
@@ -30,7 +31,8 @@ namespace PixiEditor
             viewModel.CloseAction = Close;
             Application.Current.ShutdownMode = ShutdownMode.OnMainWindowClose;
 
-            HideOrShowColorPickerPanels();
+            ColorPanelController controller = new ColorPanelController(colorPickerPanel, colorSlidersPanel, smallColorPickerPanel);
+            controller.DeterminePanelsToDisplay();
         }
 
         protected override void OnClosing(CancelEventArgs e)
@@ -39,21 +41,6 @@ namespace PixiEditor
             viewModel.DiscordViewModel.Dispose();
         }
 
-        private void HideOrShowColorPickerPanels()
-        {
-            if (SystemParameters.PrimaryScreenHeight < 1010)
-            {
-                colorPickerPanel.IsVisible = false;
-                colorSlidersPanel.IsVisible = true;
-                smallColorPickerPanel.IsVisible = true;
-            }
-            else
-            {
-                colorSlidersPanel.IsVisible = false;
-                smallColorPickerPanel.IsVisible = false;
-            }
-        }
-
         private void CommandBinding_CanExecute(object sender, CanExecuteRoutedEventArgs e)
         {
             e.CanExecute = true;