瀏覽代碼

Refactor: migrate various commands and properties to `GlobalSettingsViewModel`, `MainWindowViewModel`, and `ToolsViewModel`. Update bindings across views, remove redundant commands and properties from `MainViewModel`, and streamline logic for better organization and maintainability.

Ruben 3 月之前
父節點
當前提交
3b6d7a19ec
共有 35 個文件被更改,包括 242 次插入282 次删除
  1. 1 1
      src/PicView.Avalonia.MacOS/Views/ExifWindow.axaml
  2. 13 13
      src/PicView.Avalonia.MacOS/Views/MacMainWindow.axaml
  3. 2 2
      src/PicView.Avalonia.MacOS/Views/MacOSTitlebar.axaml
  4. 1 1
      src/PicView.Avalonia.Win32/Views/ExifWindow.axaml
  5. 3 3
      src/PicView.Avalonia.Win32/Views/WinTitleBar.axaml
  6. 4 4
      src/PicView.Avalonia/Converters/ConversionHelper.cs
  7. 3 3
      src/PicView.Avalonia/Crop/CropFunctions.cs
  8. 1 1
      src/PicView.Avalonia/Gallery/GalleryFunctions.cs
  9. 1 1
      src/PicView.Avalonia/Navigation/ErrorHandling.cs
  10. 1 1
      src/PicView.Avalonia/Navigation/NavigationManager.cs
  11. 3 3
      src/PicView.Avalonia/Navigation/UpdateImage.cs
  12. 4 5
      src/PicView.Avalonia/SettingsManagement/SettingsUpdater.cs
  13. 1 1
      src/PicView.Avalonia/StartUp/QuickLoad.cs
  14. 1 1
      src/PicView.Avalonia/StartUp/StartUpHelper.cs
  15. 2 183
      src/PicView.Avalonia/ViewModels/MainViewModel.cs
  16. 5 0
      src/PicView.Avalonia/ViewModels/MainWindowViewModel.cs
  17. 128 0
      src/PicView.Avalonia/ViewModels/ToolsViewModel.cs
  18. 5 5
      src/PicView.Avalonia/Views/AppearanceView.axaml
  19. 1 1
      src/PicView.Avalonia/Views/BottomBar.axaml
  20. 1 1
      src/PicView.Avalonia/Views/GallerySettingsView.axaml
  21. 1 1
      src/PicView.Avalonia/Views/GeneralSettingsView.axaml
  22. 2 2
      src/PicView.Avalonia/Views/ImageInfoView.axaml
  23. 2 2
      src/PicView.Avalonia/Views/ImageSettingsView.axaml
  24. 1 1
      src/PicView.Avalonia/Views/ImageViewer.axaml
  25. 18 18
      src/PicView.Avalonia/Views/MainView.axaml
  26. 1 1
      src/PicView.Avalonia/Views/MainView.axaml.cs
  27. 4 4
      src/PicView.Avalonia/Views/NavigationView.axaml
  28. 1 1
      src/PicView.Avalonia/Views/SettingsView.axaml
  29. 1 1
      src/PicView.Avalonia/Views/UC/Buttons/SettingsMenuButton.axaml
  30. 9 9
      src/PicView.Avalonia/Views/UC/Menus/ImageMenu.axaml
  31. 5 5
      src/PicView.Avalonia/Views/UC/Menus/SettingsMenu.axaml
  32. 4 4
      src/PicView.Avalonia/Views/UC/Menus/ToolsMenu.axaml
  33. 3 3
      src/PicView.Avalonia/Views/WindowSettingsView.axaml
  34. 6 0
      src/PicView.Core/ViewModels/GlobalSettingsViewModel.cs
  35. 3 0
      src/PicView.Core/ViewModels/PicViewerModel.cs

+ 1 - 1
src/PicView.Avalonia.MacOS/Views/ExifWindow.axaml

@@ -52,7 +52,7 @@
                 BorderBrush="{DynamicResource MainBorderColor}"
                 BorderBrush="{DynamicResource MainBorderColor}"
                 BorderThickness="0,0,1,0"
                 BorderThickness="0,0,1,0"
                 Classes="noBorderHover"
                 Classes="noBorderHover"
-                Command="{Binding OptimizeImageCommand}"
+                Command="{Binding Tools.OptimizeImageCommand}"
                 CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                 CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                                                    FallbackValue=''}"
                                                    FallbackValue=''}"
                 DockPanel.Dock="Right"
                 DockPanel.Dock="Right"

+ 13 - 13
src/PicView.Avalonia.MacOS/Views/MacMainWindow.axaml

@@ -119,26 +119,26 @@
             <NativeMenuItem Header="{CompiledBinding Translation.Image.Value, Mode=OneWay}">
             <NativeMenuItem Header="{CompiledBinding Translation.Image.Value, Mode=OneWay}">
                 <NativeMenu>
                 <NativeMenu>
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding RotateLeftCommand}"
+                        Command="{CompiledBinding Tools.RotateLeftCommand}"
                         Header="{CompiledBinding Translation.RotateLeft.Value,
                         Header="{CompiledBinding Translation.RotateLeft.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
                         IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
                                                     Converter={x:Static ObjectConverters.IsNotNull}}" />
                                                     Converter={x:Static ObjectConverters.IsNotNull}}" />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding RotateRightCommand}"
+                        Command="{CompiledBinding Tools.RotateRightCommand}"
                         Header="{CompiledBinding Translation.RotateRight.Value,
                         Header="{CompiledBinding Translation.RotateRight.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
                         IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
                                                     Converter={x:Static ObjectConverters.IsNotNull}}" />
                                                     Converter={x:Static ObjectConverters.IsNotNull}}" />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding FlipCommand}"
+                        Command="{CompiledBinding Tools.FlipCommand}"
                         Header="{CompiledBinding Translation.Flip.Value,
                         Header="{CompiledBinding Translation.Flip.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
                         IsEnabled="{CompiledBinding PicViewer.FileInfo.Value,
                                                     Converter={x:Static ObjectConverters.IsNotNull}}" />
                                                     Converter={x:Static ObjectConverters.IsNotNull}}" />
                     <NativeMenuItemSeparator />
                     <NativeMenuItemSeparator />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding CropCommand}"
+                        Command="{CompiledBinding Tools.CropCommand}"
                         CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                         CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                                                            FallbackValue=''}"
                                                            FallbackValue=''}"
                         Header="{CompiledBinding Translation.Crop.Value,
                         Header="{CompiledBinding Translation.Crop.Value,
@@ -169,7 +169,7 @@
                     <NativeMenuItem Command="{CompiledBinding Window.ShowBatchResizeWindow}" Header="{CompiledBinding Translation.BatchResize.Value, Mode=OneWay}" />
                     <NativeMenuItem Command="{CompiledBinding Window.ShowBatchResizeWindow}" Header="{CompiledBinding Translation.BatchResize.Value, Mode=OneWay}" />
                     <NativeMenuItemSeparator />
                     <NativeMenuItemSeparator />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding OptimizeImageCommand}"
+                        Command="{CompiledBinding Tools.OptimizeImageCommand}"
                         CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                         CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                                                            FallbackValue=''}"
                                                            FallbackValue=''}"
                         Header="{CompiledBinding Translation.OptimizeImage.Value,
                         Header="{CompiledBinding Translation.OptimizeImage.Value,
@@ -208,12 +208,12 @@
                 <NativeMenu>
                 <NativeMenu>
                     <NativeMenuItem Command="{CompiledBinding MainWindow.ToggleFullscreenCommand}" Header="{CompiledBinding Translation.ToggleFullscreen.Value, Mode=OneWay}" />
                     <NativeMenuItem Command="{CompiledBinding MainWindow.ToggleFullscreenCommand}" Header="{CompiledBinding Translation.ToggleFullscreen.Value, Mode=OneWay}" />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding ChangeAutoFitCommand}"
+                        Command="{CompiledBinding Tools.ChangeAutoFitCommand}"
                         Header="{CompiledBinding Translation.AutoFitWindow.Value,
                         Header="{CompiledBinding Translation.AutoFitWindow.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
                         IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
                         ToggleType="CheckBox" />
                         ToggleType="CheckBox" />
-                    <NativeMenuItem Command="{CompiledBinding ToggleUICommand}" Header="{CompiledBinding Translation.IsShowingUI.Value, Mode=OneWay}" />
+                    <NativeMenuItem Command="{CompiledBinding Tools.ToggleUICommand}" Header="{CompiledBinding Translation.IsShowingUI.Value, Mode=OneWay}" />
                     <NativeMenuItem Command="{CompiledBinding Gallery.ToggleGalleryCommand}" Header="{CompiledBinding Translation.ShowImageGallery.Value, Mode=OneWay}" />
                     <NativeMenuItem Command="{CompiledBinding Gallery.ToggleGalleryCommand}" Header="{CompiledBinding Translation.ShowImageGallery.Value, Mode=OneWay}" />
 
 
                 </NativeMenu>
                 </NativeMenu>
@@ -276,36 +276,36 @@
             <!--  Settings  -->
             <!--  Settings  -->
             <NativeMenuItem Header="{CompiledBinding Translation.Settings.Value, Mode=OneWay}">
             <NativeMenuItem Header="{CompiledBinding Translation.Settings.Value, Mode=OneWay}">
                 <NativeMenu>
                 <NativeMenu>
-                    <NativeMenuItem Command="{CompiledBinding ChangeBackgroundCommand}" Header="{CompiledBinding Translation.ChangeBackground.Value, Mode=OneWay}" />
+                    <NativeMenuItem Command="{CompiledBinding Tools.ChangeBackgroundCommand}" Header="{CompiledBinding Translation.ChangeBackground.Value, Mode=OneWay}" />
                     <NativeMenuItemSeparator />
                     <NativeMenuItemSeparator />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding ToggleLoopingCommand}"
+                        Command="{CompiledBinding Tools.ToggleLoopingCommand}"
                         Header="{CompiledBinding Translation.IsLooping.Value,
                         Header="{CompiledBinding Translation.IsLooping.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsChecked="{CompiledBinding GlobalSettings.IsLooping.Value}"
                         IsChecked="{CompiledBinding GlobalSettings.IsLooping.Value}"
                         ToggleType="CheckBox" />
                         ToggleType="CheckBox" />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding StretchCommand}"
+                        Command="{CompiledBinding Tools.StretchCommand}"
                         Header="{CompiledBinding Translation.Stretch.Value,
                         Header="{CompiledBinding Translation.Stretch.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsChecked="{CompiledBinding GlobalSettings.IsStretched.Value}"
                         IsChecked="{CompiledBinding GlobalSettings.IsStretched.Value}"
                         ToggleType="CheckBox" />
                         ToggleType="CheckBox" />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding ToggleScrollCommand}"
+                        Command="{CompiledBinding Tools.ToggleScrollCommand}"
                         Header="{CompiledBinding Translation.ToggleScroll.Value,
                         Header="{CompiledBinding Translation.ToggleScroll.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsChecked="{CompiledBinding GlobalSettings.IsScrollingEnabled.Value}"
                         IsChecked="{CompiledBinding GlobalSettings.IsScrollingEnabled.Value}"
                         ToggleType="CheckBox" />
                         ToggleType="CheckBox" />
                     <NativeMenuItemSeparator />
                     <NativeMenuItemSeparator />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding ChangeTopMostCommand}"
+                        Command="{CompiledBinding Tools.ChangeTopMostCommand}"
                         Header="{CompiledBinding Translation.StayTopMost.Value,
                         Header="{CompiledBinding Translation.StayTopMost.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
                         IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
                         ToggleType="CheckBox" />
                         ToggleType="CheckBox" />
                     <NativeMenuItemSeparator />
                     <NativeMenuItemSeparator />
                     <NativeMenuItem
                     <NativeMenuItem
-                        Command="{CompiledBinding ToggleSubdirectoriesCommand}"
+                        Command="{CompiledBinding Tools.ToggleSubdirectoriesCommand}"
                         Header="{CompiledBinding Translation.SearchSubdirectory.Value,
                         Header="{CompiledBinding Translation.SearchSubdirectory.Value,
                                                  Mode=OneWay}"
                                                  Mode=OneWay}"
                         IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"
                         IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"

+ 2 - 2
src/PicView.Avalonia.MacOS/Views/MacOSTitlebar.axaml

@@ -26,7 +26,7 @@
             BorderBrush="{DynamicResource MainBorderColor}"
             BorderBrush="{DynamicResource MainBorderColor}"
             BorderThickness="0"
             BorderThickness="0"
             Classes="hover"
             Classes="hover"
-            Command="{CompiledBinding FlipCommand}"
+            Command="{CompiledBinding Tools.FlipCommand}"
             Data="{StaticResource FlipGeometry}"
             Data="{StaticResource FlipGeometry}"
             DockPanel.Dock="Right"
             DockPanel.Dock="Right"
             Foreground="{DynamicResource MainTextColor}"
             Foreground="{DynamicResource MainTextColor}"
@@ -51,7 +51,7 @@
             BorderBrush="{DynamicResource MainBorderColor}"
             BorderBrush="{DynamicResource MainBorderColor}"
             BorderThickness="0"
             BorderThickness="0"
             Classes="hover"
             Classes="hover"
-            Command="{CompiledBinding RotateRightWindowBorderButtonCommand}"
+            Command="{CompiledBinding Tools.RotateRightWindowBorderButtonCommand}"
             DockPanel.Dock="Right"
             DockPanel.Dock="Right"
             Foreground="{DynamicResource MainTextColor}"
             Foreground="{DynamicResource MainTextColor}"
             Icon="{StaticResource RefreshCcwDot}"
             Icon="{StaticResource RefreshCcwDot}"

+ 1 - 1
src/PicView.Avalonia.Win32/Views/ExifWindow.axaml

@@ -112,7 +112,7 @@
                     BorderBrush="{DynamicResource MainBorderColor}"
                     BorderBrush="{DynamicResource MainBorderColor}"
                     BorderThickness="0,0,1,0"
                     BorderThickness="0,0,1,0"
                     Classes="noBorderHover"
                     Classes="noBorderHover"
-                    Command="{Binding OptimizeImageCommand}"
+                    Command="{Binding Tools.OptimizeImageCommand}"
                     CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                     CommandParameter="{CompiledBinding PicViewer.FileInfo.Value.FullName,
                                                        FallbackValue=''}"
                                                        FallbackValue=''}"
                     DockPanel.Dock="Right"
                     DockPanel.Dock="Right"

+ 3 - 3
src/PicView.Avalonia.Win32/Views/WinTitleBar.axaml

@@ -43,7 +43,7 @@
                 ToggleType="Radio"
                 ToggleType="Radio"
                 x:Name="Rotation270Item" />
                 x:Name="Rotation270Item" />
             <Separator />
             <Separator />
-            <MenuItem Command="{CompiledBinding FlipCommand}" Header="{CompiledBinding Translation.IsFlipped.Value}">
+            <MenuItem Command="{CompiledBinding Tools.FlipCommand}" Header="{CompiledBinding Translation.IsFlipped.Value}">
                 <MenuItem.Icon>
                 <MenuItem.Icon>
                     <Path
                     <Path
                         Data="{StaticResource FlipGeometry}"
                         Data="{StaticResource FlipGeometry}"
@@ -101,7 +101,7 @@
             <customControls:IconButton
             <customControls:IconButton
                 Background="{DynamicResource WindowButtonBackgroundColor}"
                 Background="{DynamicResource WindowButtonBackgroundColor}"
                 Classes="hover"
                 Classes="hover"
-                Command="{CompiledBinding RotateRightWindowBorderButtonCommand}"
+                Command="{CompiledBinding Tools.RotateRightWindowBorderButtonCommand}"
                 DockPanel.Dock="Left"
                 DockPanel.Dock="Left"
                 Foreground="{DynamicResource MainTextColor}"
                 Foreground="{DynamicResource MainTextColor}"
                 Icon="{StaticResource RefreshCcwDot}"
                 Icon="{StaticResource RefreshCcwDot}"
@@ -122,7 +122,7 @@
                 BorderBrush="{DynamicResource MainBorderColor}"
                 BorderBrush="{DynamicResource MainBorderColor}"
                 BorderThickness="1,0,1,0"
                 BorderThickness="1,0,1,0"
                 Classes="hover"
                 Classes="hover"
-                Command="{CompiledBinding FlipCommand}"
+                Command="{CompiledBinding Tools.FlipCommand}"
                 Data="{StaticResource FlipGeometry}"
                 Data="{StaticResource FlipGeometry}"
                 DockPanel.Dock="Left"
                 DockPanel.Dock="Left"
                 Foreground="{DynamicResource MainTextColor}"
                 Foreground="{DynamicResource MainTextColor}"

+ 4 - 4
src/PicView.Avalonia/Converters/ConversionHelper.cs

@@ -30,7 +30,7 @@ internal static class ConversionHelper
     {
     {
         if (vm.PicViewer.FileInfo is null)
         if (vm.PicViewer.FileInfo is null)
         {
         {
-            vm.ShouldOptimizeImageBeEnabled = false;
+            vm.GlobalSettings.ShouldOptimizeImageBeEnabled.Value = false;
             return;
             return;
         }
         }
 
 
@@ -41,17 +41,17 @@ internal static class ConversionHelper
                 || vm.PicViewer.FileInfo.CurrentValue.Extension.Equals(".png", StringComparison.InvariantCultureIgnoreCase)
                 || vm.PicViewer.FileInfo.CurrentValue.Extension.Equals(".png", StringComparison.InvariantCultureIgnoreCase)
                 || vm.PicViewer.FileInfo.CurrentValue.Extension.Equals(".gif", StringComparison.InvariantCultureIgnoreCase))
                 || vm.PicViewer.FileInfo.CurrentValue.Extension.Equals(".gif", StringComparison.InvariantCultureIgnoreCase))
             {
             {
-                vm.ShouldOptimizeImageBeEnabled = true;
+                vm.GlobalSettings.ShouldOptimizeImageBeEnabled.Value = true;
             }
             }
             else
             else
             {
             {
-                vm.ShouldOptimizeImageBeEnabled = false;
+                vm.GlobalSettings.ShouldOptimizeImageBeEnabled.Value = false;
             }
             }
         }
         }
         catch (Exception e)
         catch (Exception e)
         {
         {
             DebugHelper.LogDebug(nameof(ConversionHelper), nameof(DetermineIfOptimizeImageShouldBeEnabled), e);
             DebugHelper.LogDebug(nameof(ConversionHelper), nameof(DetermineIfOptimizeImageShouldBeEnabled), e);
-            vm.ShouldOptimizeImageBeEnabled = false;
+            vm.GlobalSettings.ShouldOptimizeImageBeEnabled.Value = false;
         }
         }
     }
     }
 }
 }

+ 3 - 3
src/PicView.Avalonia/Crop/CropFunctions.cs

@@ -119,7 +119,7 @@ public static class CropFunctions
 
 
         if (vm?.PicViewer.ImageSource.CurrentValue is not Bitmap || Settings.ImageScaling.ShowImageSideBySide)
         if (vm?.PicViewer.ImageSource.CurrentValue is not Bitmap || Settings.ImageScaling.ShowImageSideBySide)
         {
         {
-            vm.ShouldCropBeEnabled = false;
+            vm.GlobalSettings.ShouldCropBeEnabled.Value = false;
             return false;
             return false;
         }
         }
 
 
@@ -135,11 +135,11 @@ public static class CropFunctions
 
 
         if (vm.GlobalSettings.RotationAngle.CurrentValue is 0 && vm.PicViewer.ScaleX.CurrentValue is 1)
         if (vm.GlobalSettings.RotationAngle.CurrentValue is 0 && vm.PicViewer.ScaleX.CurrentValue is 1)
         {
         {
-            vm.ShouldCropBeEnabled = true;
+            vm.GlobalSettings.ShouldCropBeEnabled.Value = true;
             return true;
             return true;
         }
         }
 
 
-        vm.ShouldCropBeEnabled = false;
+        vm.GlobalSettings.ShouldCropBeEnabled.Value = false;
         return false;
         return false;
     }
     }
 }
 }

+ 1 - 1
src/PicView.Avalonia/Gallery/GalleryFunctions.cs

@@ -21,7 +21,7 @@ public static class GalleryFunctions
             return 0;
             return 0;
         }
         }
 
 
-        if (!Settings.Gallery.IsBottomGalleryShown || vm.IsSingleImage || Slideshow.IsRunning)
+        if (!Settings.Gallery.IsBottomGalleryShown || vm.PicViewer.IsSingleImage.CurrentValue || Slideshow.IsRunning)
         {
         {
             return 0;
             return 0;
         }
         }

+ 1 - 1
src/PicView.Avalonia/Navigation/ErrorHandling.cs

@@ -51,7 +51,7 @@ public static class ErrorHandling
             GalleryFunctions.Clear();
             GalleryFunctions.Clear();
             MenuManager.CloseMenus(vm);
             MenuManager.CloseMenus(vm);
 
 
-            vm.GetIndex = 0;
+            vm.PicViewer.GetIndex.Value = 0;
             vm.PlatformService.StopTaskbarProgress();
             vm.PlatformService.StopTaskbarProgress();
             vm.MainWindow.IsLoadingIndicatorShown.Value = false;
             vm.MainWindow.IsLoadingIndicatorShown.Value = false;
 
 

+ 1 - 1
src/PicView.Avalonia/Navigation/NavigationManager.cs

@@ -88,7 +88,7 @@ public static class NavigationManager
         }
         }
         else
         else
         {
         {
-            vm.IsSingleImage = false;
+            vm.PicViewer.IsSingleImage.Value = false;
             var isTiffUpdated = await CheckIfTiffAndUpdate(vm, fileInfo, index);
             var isTiffUpdated = await CheckIfTiffAndUpdate(vm, fileInfo, index);
             if (!isTiffUpdated)
             if (!isTiffUpdated)
             {
             {

+ 3 - 3
src/PicView.Avalonia/Navigation/UpdateImage.cs

@@ -288,7 +288,7 @@ public static class UpdateImage
             vm.Gallery.GalleryMargin.Value = new Thickness(0);
             vm.Gallery.GalleryMargin.Value = new Thickness(0);
         }
         }
 
 
-        vm.IsSingleImage = true;
+        vm.PicViewer.IsSingleImage.Value = true;
         await Dispatcher.UIThread.InvokeAsync(() => { UIHelper.GetGalleryView.IsVisible = false; }, DispatcherPriority.Render);
         await Dispatcher.UIThread.InvokeAsync(() => { UIHelper.GetGalleryView.IsVisible = false; }, DispatcherPriority.Render);
         await NavigationManager.DisposeImageIteratorAsync();
         await NavigationManager.DisposeImageIteratorAsync();
     }
     }
@@ -299,10 +299,10 @@ public static class UpdateImage
 
 
     public static void SetStats(MainViewModel vm, ImageModel imageModel)
     public static void SetStats(MainViewModel vm, ImageModel imageModel)
     {
     {
-        vm.IsSingleImage = false;
+        vm.PicViewer.IsSingleImage.Value = false;
         vm.PicViewer.PixelWidth.Value = imageModel.PixelWidth;
         vm.PicViewer.PixelWidth.Value = imageModel.PixelWidth;
         vm.PicViewer.PixelHeight.Value = imageModel.PixelHeight;
         vm.PicViewer.PixelHeight.Value = imageModel.PixelHeight;
-        vm.GetIndex = NavigationManager.GetNonZeroIndex;
+        vm.PicViewer.GetIndex.Value = NavigationManager.GetNonZeroIndex;
         vm.PicViewer.ExifOrientation.Value = imageModel.EXIFOrientation;
         vm.PicViewer.ExifOrientation.Value = imageModel.EXIFOrientation;
         vm.PicViewer.FileInfo.Value = imageModel.FileInfo;
         vm.PicViewer.FileInfo.Value = imageModel.FileInfo;
         vm.GlobalSettings.RotationAngle.Value = 1;
         vm.GlobalSettings.RotationAngle.Value = 1;

+ 4 - 5
src/PicView.Avalonia/SettingsManagement/SettingsUpdater.cs

@@ -80,7 +80,6 @@ public static class SettingsUpdater
         vm.MainWindow.IsTopToolbarShown.Value  = Settings.UIProperties.ShowInterface;
         vm.MainWindow.IsTopToolbarShown.Value  = Settings.UIProperties.ShowInterface;
         vm.MainWindow.IsBottomToolbarShown.Value   = Settings.UIProperties.ShowBottomNavBar &&
         vm.MainWindow.IsBottomToolbarShown.Value   = Settings.UIProperties.ShowBottomNavBar &&
                                     Settings.UIProperties.ShowInterface;
                                     Settings.UIProperties.ShowInterface;
-        vm.IsShowingTaskbarProgress  = Settings.UIProperties.IsTaskbarProgressEnabled;
         vm.MainWindow.IsFullscreen.Value  = Settings.WindowProperties.Fullscreen;
         vm.MainWindow.IsFullscreen.Value  = Settings.WindowProperties.Fullscreen;
         vm.MainWindow.BackgroundChoice.Value = Settings.UIProperties.BgColorChoice;
         vm.MainWindow.BackgroundChoice.Value = Settings.UIProperties.BgColorChoice;
     }
     }
@@ -400,7 +399,7 @@ public static class SettingsUpdater
     
     
     public static void TurnOffScroll(MainViewModel vm)
     public static void TurnOffScroll(MainViewModel vm)
     {
     {
-        vm.ToggleScrollBarVisibility = ScrollBarVisibility.Disabled;
+        vm.MainWindow.ToggleScrollBarVisibility.Value = ScrollBarVisibility.Disabled;
         vm.Translation.IsScrolling.Value = TranslationManager.Translation.ScrollingDisabled;
         vm.Translation.IsScrolling.Value = TranslationManager.Translation.ScrollingDisabled;
         vm.GlobalSettings.IsScrollingEnabled.Value = false;
         vm.GlobalSettings.IsScrollingEnabled.Value = false;
         Settings.Zoom.ScrollEnabled = false;
         Settings.Zoom.ScrollEnabled = false;
@@ -409,7 +408,7 @@ public static class SettingsUpdater
     
     
     public static void TurnOnScroll(MainViewModel vm)
     public static void TurnOnScroll(MainViewModel vm)
     {
     {
-        vm.ToggleScrollBarVisibility = ScrollBarVisibility.Visible;
+        vm.MainWindow.ToggleScrollBarVisibility.Value = ScrollBarVisibility.Visible;
         vm.Translation.IsScrolling.Value = TranslationManager.Translation.ScrollingEnabled;
         vm.Translation.IsScrolling.Value = TranslationManager.Translation.ScrollingEnabled;
         vm.GlobalSettings.IsScrollingEnabled.Value = true;
         vm.GlobalSettings.IsScrollingEnabled.Value = true;
         Settings.Zoom.ScrollEnabled = true;
         Settings.Zoom.ScrollEnabled = true;
@@ -438,7 +437,7 @@ public static class SettingsUpdater
             return;
             return;
         }
         }
         var isNavigatingWithCtrl = Settings.Zoom.CtrlZoom;
         var isNavigatingWithCtrl = Settings.Zoom.CtrlZoom;
-        vm.ChangeCtrlZoomImage = isNavigatingWithCtrl ? leftRightArrowsImage as DrawingImage : scanEyeImage as DrawingImage;
+        vm.MainWindow.ChangeCtrlZoomImage.Value = isNavigatingWithCtrl ? leftRightArrowsImage as DrawingImage : scanEyeImage as DrawingImage;
         await SaveSettingsAsync().ConfigureAwait(false);
         await SaveSettingsAsync().ConfigureAwait(false);
     }
     }
     
     
@@ -450,7 +449,7 @@ public static class SettingsUpdater
         {
         {
             return;
             return;
         }
         }
-        vm.ChangeCtrlZoomImage = scanEyeImage as DrawingImage;
+        vm.MainWindow.ChangeCtrlZoomImage.Value = scanEyeImage as DrawingImage;
     }
     }
     
     
     public static async Task ToggleLooping(MainViewModel vm)
     public static async Task ToggleLooping(MainViewModel vm)

+ 1 - 1
src/PicView.Avalonia/StartUp/QuickLoad.cs

@@ -67,7 +67,7 @@ public static class QuickLoad
         }
         }
 
 
         vm.MainWindow.IsLoadingIndicatorShown.Value = false;
         vm.MainWindow.IsLoadingIndicatorShown.Value = false;
-        vm.GetIndex = NavigationManager.GetNonZeroIndex;
+        vm.PicViewer.GetIndex.Value = NavigationManager.GetNonZeroIndex;
     }
     }
 
 
     /// <summary>
     /// <summary>

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

@@ -193,7 +193,7 @@ public static class StartUpHelper
         }
         }
         else
         else
         {
         {
-            vm.ToggleScrollBarVisibility = ScrollBarVisibility.Disabled;
+            vm.MainWindow.ToggleScrollBarVisibility.Value = ScrollBarVisibility.Disabled;
             vm.GlobalSettings.IsScrollingEnabled.Value = false;
             vm.GlobalSettings.IsScrollingEnabled.Value = false;
         }
         }
 
 

+ 2 - 183
src/PicView.Avalonia/ViewModels/MainViewModel.cs

@@ -1,17 +1,11 @@
-using System.Reactive;
-using Avalonia.Controls.Primitives;
-using Avalonia.Media;
-using PicView.Avalonia.Functions;
-using PicView.Avalonia.ImageTransformations.Rotation;
+using PicView.Avalonia.Functions;
 using PicView.Avalonia.Interfaces;
 using PicView.Avalonia.Interfaces;
-using PicView.Avalonia.UI;
 using PicView.Core.ViewModels;
 using PicView.Core.ViewModels;
-using ReactiveUI;
 using ImageViewer = PicView.Avalonia.Views.ImageViewer;
 using ImageViewer = PicView.Avalonia.Views.ImageViewer;
 
 
 namespace PicView.Avalonia.ViewModels;
 namespace PicView.Avalonia.ViewModels;
 
 
-public class MainViewModel : ReactiveObject
+public class MainViewModel
 {
 {
     public readonly IPlatformSpecificService? PlatformService;
     public readonly IPlatformSpecificService? PlatformService;
     public readonly IPlatformWindowService? PlatformWindowService;
     public readonly IPlatformWindowService? PlatformWindowService;
@@ -35,193 +29,18 @@ public class MainViewModel : ReactiveObject
         FunctionsMapper.Vm = this;
         FunctionsMapper.Vm = this;
         PlatformService = platformSpecificService;
         PlatformService = platformSpecificService;
         PlatformWindowService = platformWindowService;
         PlatformWindowService = platformWindowService;
-
-
-
-        #region Image commands
-
-        RotateLeftCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.RotateLeft);
-        RotateLeftButtonCommand = FunctionsHelper.CreateReactiveCommand(async () =>
-        {
-            await RotationNavigation.RotateLeft(this, RotationButton.RotateLeftButton);
-        });
-
-        RotateRightCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.RotateRight);
-        RotateRightButtonCommand = FunctionsHelper.CreateReactiveCommand(async () =>
-        {
-            await RotationNavigation.RotateRight(this, RotationButton.RotateRightButton);
-        });
-
-        RotateRightWindowBorderButtonCommand = FunctionsHelper.CreateReactiveCommand(async () =>
-        {
-            await RotationNavigation.RotateRight(this, RotationButton.WindowBorderButton);
-        });
-
-        FlipCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Flip);
-
-        StretchCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Stretch);
-
-        CropCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Crop);
-
-        ToggleScrollCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleScroll);
-
-        OptimizeImageCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.OptimizeImage);
-
-        ChangeBackgroundCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ChangeBackground);
-
-        ShowSideBySideCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SideBySide);
-
-        #endregion Image commands
-
-        #region UI Commands
-
-        ToggleUICommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleInterface);
-
-        ToggleBottomNavBarCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleBottomToolbar);
-
-        ToggleBottomGalleryShownInHiddenUICommand = FunctionsHelper.CreateReactiveCommand(async () =>
-        {
-            await HideInterfaceLogic.ToggleBottomGalleryShownInHiddenUI(this);
-        });
-
-        ToggleFadeInButtonsOnHoverCommand = FunctionsHelper.CreateReactiveCommand(async () =>
-        {
-            await HideInterfaceLogic.ToggleFadeInButtonsOnHover(this);
-        });
-
-        ChangeCtrlZoomCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ChangeCtrlZoom);
-
-        ToggleTaskbarProgressCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleTaskbarProgress);
-        
-        ToggleConstrainBackgroundColorCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleConstrainBackgroundColor);
-
-        #endregion UI Commands
-
-        #region Settings commands
-
-        ChangeAutoFitCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.AutoFitWindow);
-
-        ChangeTopMostCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.SetTopMost);
-
-        ToggleSubdirectoriesCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleSubdirectories);
-
-        ToggleLoopingCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleLooping);
-
-        ResetSettingsCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ResetSettings);
-
-        RestartCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.Restart);
-        
-        ToggleOpeningInSameWindowCommand = FunctionsHelper.CreateReactiveCommand(FunctionsMapper.ToggleOpeningInSameWindow);
-
-        #endregion Settings commands
     }
     }
 
 
     public MainViewModel()
     public MainViewModel()
     {
     {
         // Only use for unit test
         // Only use for unit test
     }
     }
-
-    #region Commands
-    public ReactiveCommand<Unit, Unit>? ToggleLoopingCommand { get; }
-    public ReactiveCommand<Unit, Unit>? RotateLeftCommand { get; }
-    public ReactiveCommand<Unit, Unit>? RotateLeftButtonCommand { get; }
-    public ReactiveCommand<Unit, Unit>? RotateRightCommand { get; }
-    public ReactiveCommand<Unit, Unit>? RotateRightButtonCommand { get; }
-    public ReactiveCommand<Unit, Unit>? RotateRightWindowBorderButtonCommand { get; }
-    public ReactiveCommand<Unit, Unit>? FlipCommand { get; }
-    public ReactiveCommand<Unit, Unit>? StretchCommand { get; }
-    public ReactiveCommand<Unit, Unit>? CropCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ChangeAutoFitCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ChangeTopMostCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ChangeCtrlZoomCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ToggleUICommand { get; }
-    public ReactiveCommand<Unit, Unit>? ToggleOpeningInSameWindowCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ChangeBackgroundCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ToggleBottomNavBarCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ToggleBottomGalleryShownInHiddenUICommand { get; }
-
-    public ReactiveCommand<Unit, Unit>? ToggleFadeInButtonsOnHoverCommand { get; }
-    public ReactiveCommand<Unit, Unit>? ToggleTaskbarProgressCommand { get; }
-
-    public ReactiveCommand<Unit, Unit>? OptimizeImageCommand { get; }
-
-    public ReactiveCommand<Unit, Unit>? ToggleScrollCommand { get; }
-
-    public ReactiveCommand<Unit, Unit>? ToggleSubdirectoriesCommand { get; }
-
-    public ReactiveCommand<Unit, Unit>? ResetSettingsCommand { get; }
-
-    public ReactiveCommand<Unit, Unit>? ShowSideBySideCommand { get; }
-
-    public ReactiveCommand<Unit, Unit>? RestartCommand { get; }
-    
-    public ReactiveCommand<Unit, Unit>? ToggleConstrainBackgroundColorCommand { get; }
-
-    #endregion Commands
-
-    #region Fields
-
-    #region Booleans
-
-    public bool ShouldCropBeEnabled
-    {
-        get;
-        set => this.RaiseAndSetIfChanged(ref field, value);
-    }
-
-    public bool ShouldOptimizeImageBeEnabled
-    {
-        get;
-        set => this.RaiseAndSetIfChanged(ref field, value);
-    }
-
-
-
-    public IImage? ChangeCtrlZoomImage
-    {
-        get;
-        set => this.RaiseAndSetIfChanged(ref field, value);
-    }
-
-
-
-    public bool IsShowingTaskbarProgress
-    {
-        get;
-        set => this.RaiseAndSetIfChanged(ref field, value);
-    }
-
- 
-
-
-
-    public bool IsSingleImage
-    {
-        get;
-        set => this.RaiseAndSetIfChanged(ref field, value);
-    }
-
-    #endregion Booleans
     
     
     public ImageViewer? ImageViewer;
     public ImageViewer? ImageViewer;
 
 
-    public int GetIndex
-    {
-        get;
-        set => this.RaiseAndSetIfChanged(ref field, value);
-    }
-
 
 
 
 
 
 
 
 
-    public ScrollBarVisibility ToggleScrollBarVisibility
-    {
-        get;
-        set => this.RaiseAndSetIfChanged(ref field, value);
-    }
-
-
 
 
-    #endregion Fields
 }
 }

+ 5 - 0
src/PicView.Avalonia/ViewModels/MainWindowViewModel.cs

@@ -1,5 +1,6 @@
 using Avalonia;
 using Avalonia;
 using Avalonia.Controls;
 using Avalonia.Controls;
+using Avalonia.Controls.Primitives;
 using Avalonia.Media;
 using Avalonia.Media;
 using PicView.Avalonia.Functions;
 using PicView.Avalonia.Functions;
 using PicView.Avalonia.UI;
 using PicView.Avalonia.UI;
@@ -31,6 +32,8 @@ public class MainWindowViewModel : IDisposable
     public BindableReactiveProperty<double> BottombarHeight { get; } = new();
     public BindableReactiveProperty<double> BottombarHeight { get; } = new();
     
     
     public BindableReactiveProperty<SizeToContent> SizeToContent { get; } = new();
     public BindableReactiveProperty<SizeToContent> SizeToContent { get; } = new();
+    
+    public BindableReactiveProperty<ScrollBarVisibility> ToggleScrollBarVisibility { get; } = new();
 
 
     public BindableReactiveProperty<bool> CanResize { get; } = new();
     public BindableReactiveProperty<bool> CanResize { get; } = new();
 
 
@@ -62,6 +65,8 @@ public class MainWindowViewModel : IDisposable
     public BindableReactiveProperty<bool> IsBottomToolbarShown { get; } = new();
     public BindableReactiveProperty<bool> IsBottomToolbarShown { get; } = new();
 
 
     public BindableReactiveProperty<bool> IsEditableTitlebarOpen { get; } = new();
     public BindableReactiveProperty<bool> IsEditableTitlebarOpen { get; } = new();
+    
+    public BindableReactiveProperty<IImage?> ChangeCtrlZoomImage { get; } = new();
 
 
     public void LayoutButtonSubscription()
     public void LayoutButtonSubscription()
     {
     {

+ 128 - 0
src/PicView.Avalonia/ViewModels/ToolsViewModel.cs

@@ -138,13 +138,141 @@ public class ToolsViewModel : IDisposable
         }
         }
     });
     });
     
     
+    // Settings
+    public ReactiveCommand ChangeAutoFitCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.AutoFitWindow().ConfigureAwait(false);
+    });
+    
+    public ReactiveCommand ChangeTopMostCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.SetTopMost().ConfigureAwait(false);
+    });
     
     
+    public ReactiveCommand ToggleSubdirectoriesCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleSubdirectories().ConfigureAwait(false);
+    });
+
+    public ReactiveCommand ToggleLoopingCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleLooping().ConfigureAwait(false);
+    });
+    
+    public ReactiveCommand ResetSettingsCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ResetSettings().ConfigureAwait(false);
+    });
+    
+    public ReactiveCommand RestartCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.Restart().ConfigureAwait(false);
+    });
+    
+    public ReactiveCommand ToggleOpeningInSameWindowCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleOpeningInSameWindow().ConfigureAwait(false);
+    });
     
     
     public ReactiveCommand ToggleUsingTouchPadCommand { get; } = new(async (_, _) =>
     public ReactiveCommand ToggleUsingTouchPadCommand { get; } = new(async (_, _) =>
     {
     {
         await SettingsUpdater.ToggleUsingTouchpad(UIHelper.GetMainView.DataContext as MainViewModel);
         await SettingsUpdater.ToggleUsingTouchpad(UIHelper.GetMainView.DataContext as MainViewModel);
     });
     });
     
     
+    // UI
+    public ReactiveCommand ToggleUICommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleInterface();
+    });
+    
+    public ReactiveCommand ToggleBottomNavBarCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleBottomToolbar();
+    });
+    
+    public ReactiveCommand ToggleBottomGalleryShownInHiddenUICommand { get; } = new(async (_, _) =>
+    {
+        await HideInterfaceLogic.ToggleBottomGalleryShownInHiddenUI(UIHelper.GetMainView.DataContext as MainViewModel);
+    });
+    
+    public ReactiveCommand ToggleFadeInButtonsOnHoverCommand { get; } = new(async (_, _) =>
+    {
+        await HideInterfaceLogic.ToggleFadeInButtonsOnHover(UIHelper.GetMainView.DataContext as MainViewModel);
+    });
+    
+    public ReactiveCommand ChangeCtrlZoomCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ChangeCtrlZoom();
+    });
+    
+    public ReactiveCommand ToggleTaskbarProgressCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleTaskbarProgress();
+    });
+    
+    public ReactiveCommand ToggleConstrainBackgroundColorCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleConstrainBackgroundColor();
+    });
+    
+    // Image related
+    public ReactiveCommand RotateLeftCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.RotateLeft();
+    });
+    public ReactiveCommand RotateLeftButtonCommand { get; } = new(async (_, _) =>
+    {
+        await RotationNavigation.RotateLeft(UIHelper.GetMainView.DataContext as MainViewModel, RotationButton.RotateLeftButton);
+    });
+    
+    public ReactiveCommand RotateRightCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.RotateRight();
+    });
+    public ReactiveCommand RotateRightButtonCommand { get; } = new(async (_, _) =>
+    {
+        await RotationNavigation.RotateRight(UIHelper.GetMainView.DataContext as MainViewModel, RotationButton.RotateLeftButton);
+    });
+    
+    public ReactiveCommand RotateRightWindowBorderButtonCommand { get; } = new(async (_, _) =>
+    {
+        await RotationNavigation.RotateRight(UIHelper.GetMainView.DataContext as MainViewModel, RotationButton.WindowBorderButton);
+    });
+    
+    public ReactiveCommand FlipCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.Flip();
+    });
+    
+    public ReactiveCommand StretchCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.Stretch();
+    });
+    
+    public ReactiveCommand CropCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.Crop();
+    });
+    
+    public ReactiveCommand ToggleScrollCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ToggleScroll();
+    });
+    
+    public ReactiveCommand OptimizeImageCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.OptimizeImage();
+    });
+    
+    public ReactiveCommand ChangeBackgroundCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.ChangeBackground();
+    });
+    
+    public ReactiveCommand ShowSideBySideCommand { get; } = new(async (_, _) =>
+    {
+        await FunctionsMapper.SideBySide();
+    });
     
     
     public async Task StartSlideShowTask(int milliseconds) =>
     public async Task StartSlideShowTask(int milliseconds) =>
         await Slideshow.StartSlideshow(UIHelper.GetMainView.DataContext as MainViewModel, milliseconds);
         await Slideshow.StartSlideshow(UIHelper.GetMainView.DataContext as MainViewModel, milliseconds);

+ 5 - 5
src/PicView.Avalonia/Views/AppearanceView.axaml

@@ -54,7 +54,7 @@
 
 
         <Button
         <Button
             Classes="errorHover"
             Classes="errorHover"
-            Command="{Binding RestartCommand}"
+            Command="{Binding Tools.RestartCommand}"
             Margin="0,0,0,20">
             Margin="0,0,0,20">
             <TextBlock
             <TextBlock
                 Classes="txt"
                 Classes="txt"
@@ -284,7 +284,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover"
             Classes="altHover"
-            Command="{CompiledBinding ToggleConstrainBackgroundColorCommand}"
+            Command="{CompiledBinding Tools.ToggleConstrainBackgroundColorCommand}"
             IsChecked="{CompiledBinding SettingsViewModel.IsConstrainingBackgroundColor.Value}"
             IsChecked="{CompiledBinding SettingsViewModel.IsConstrainingBackgroundColor.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">
@@ -310,7 +310,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover"
             Classes="altHover"
-            Command="{CompiledBinding ToggleBottomNavBarCommand}"
+            Command="{CompiledBinding Tools.ToggleBottomNavBarCommand}"
             Foreground="{StaticResource SecondaryTextColor}"
             Foreground="{StaticResource SecondaryTextColor}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Padding="0,10,0,10"
             Padding="0,10,0,10"
@@ -371,7 +371,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover"
             Classes="altHover"
-            Command="{CompiledBinding ToggleUICommand}"
+            Command="{CompiledBinding Tools.ToggleUICommand}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Padding="0,10,0,10"
             Padding="0,10,0,10"
             Width="300">
             Width="300">
@@ -478,7 +478,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover"
             Classes="altHover"
-            Command="{CompiledBinding ToggleFadeInButtonsOnHoverCommand}"
+            Command="{CompiledBinding Tools.ToggleFadeInButtonsOnHoverCommand}"
             Foreground="{StaticResource SecondaryTextColor}"
             Foreground="{StaticResource SecondaryTextColor}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Padding="0,10,0,10"
             Padding="0,10,0,10"

+ 1 - 1
src/PicView.Avalonia/Views/BottomBar.axaml

@@ -179,7 +179,7 @@
             <Separator />
             <Separator />
 
 
             <!--  Hide bottom bar  -->
             <!--  Hide bottom bar  -->
-            <MenuItem Command="{CompiledBinding ToggleBottomNavBarCommand}" Header="{CompiledBinding Translation.HideBottomToolbar.Value, Mode=OneWay}">
+            <MenuItem Command="{CompiledBinding Tools.ToggleBottomNavBarCommand}" Header="{CompiledBinding Translation.HideBottomToolbar.Value, Mode=OneWay}">
                 <MenuItem.Icon>
                 <MenuItem.Icon>
                     <Image
                     <Image
                         Height="12"
                         Height="12"

+ 1 - 1
src/PicView.Avalonia/Views/GallerySettingsView.axaml

@@ -51,7 +51,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ToggleBottomGalleryShownInHiddenUICommand}"
+            Command="{CompiledBinding Tools.ToggleBottomGalleryShownInHiddenUICommand}"
             IsChecked="{CompiledBinding SettingsViewModel.IsBottomGalleryShownInHiddenUI.Value}"
             IsChecked="{CompiledBinding SettingsViewModel.IsBottomGalleryShownInHiddenUI.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">

+ 1 - 1
src/PicView.Avalonia/Views/GeneralSettingsView.axaml

@@ -83,7 +83,7 @@
                 Background="Transparent"
                 Background="Transparent"
                 BorderThickness="0"
                 BorderThickness="0"
                 Classes="altHover changeColor"
                 Classes="altHover changeColor"
-                Command="{CompiledBinding ToggleSubdirectoriesCommand}"
+                Command="{CompiledBinding Tools.ToggleSubdirectoriesCommand}"
                 IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"
                 IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"
                 Margin="0,0,0,10"
                 Margin="0,0,0,10"
                 Width="300">
                 Width="300">

+ 2 - 2
src/PicView.Avalonia/Views/ImageInfoView.axaml

@@ -255,10 +255,10 @@
 
 
             <!--  Optimize image  -->
             <!--  Optimize image  -->
             <MenuItem
             <MenuItem
-                Command="{CompiledBinding OptimizeImageCommand}"
+                Command="{CompiledBinding Tools.OptimizeImageCommand}"
                 Header="{CompiledBinding Translation.OptimizeImage.Value,
                 Header="{CompiledBinding Translation.OptimizeImage.Value,
                                          Mode=OneWay}"
                                          Mode=OneWay}"
-                IsEnabled="{CompiledBinding ShouldOptimizeImageBeEnabled,
+                IsEnabled="{CompiledBinding GlobalSettings.ShouldOptimizeImageBeEnabled.Value,
                                             Mode=OneWay}">
                                             Mode=OneWay}">
                 <MenuItem.Icon>
                 <MenuItem.Icon>
                     <Image
                     <Image

+ 2 - 2
src/PicView.Avalonia/Views/ImageSettingsView.axaml

@@ -43,7 +43,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ToggleScrollCommand}"
+            Command="{CompiledBinding Tools.ToggleScrollCommand}"
             IsChecked="{CompiledBinding GlobalSettings.IsScrollingEnabled.Value}"
             IsChecked="{CompiledBinding GlobalSettings.IsScrollingEnabled.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">
@@ -61,7 +61,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ShowSideBySideCommand}"
+            Command="{CompiledBinding Tools.ShowSideBySideCommand}"
             IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide.Value}"
             IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">

+ 1 - 1
src/PicView.Avalonia/Views/ImageViewer.axaml

@@ -21,7 +21,7 @@
                                      Mode=OneWay}"
                                      Mode=OneWay}"
             ScrollChanged="ImageScrollViewer_OnScrollChanged"
             ScrollChanged="ImageScrollViewer_OnScrollChanged"
             Theme="{StaticResource Main}"
             Theme="{StaticResource Main}"
-            VerticalScrollBarVisibility="{CompiledBinding ToggleScrollBarVisibility}"
+            VerticalScrollBarVisibility="{CompiledBinding MainWindow.ToggleScrollBarVisibility.Value}"
             Width="{CompiledBinding PicViewer.ScrollViewerWidth.Value,
             Width="{CompiledBinding PicViewer.ScrollViewerWidth.Value,
                                     Mode=OneWay}"
                                     Mode=OneWay}"
             x:Name="ImageScrollViewer">
             x:Name="ImageScrollViewer">

+ 18 - 18
src/PicView.Avalonia/Views/MainView.axaml

@@ -341,7 +341,7 @@
 
 
                 <!--  Toggle Subdirectories  -->
                 <!--  Toggle Subdirectories  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ToggleSubdirectoriesCommand}"
+                    Command="{CompiledBinding Tools.ToggleSubdirectoriesCommand}"
                     Header="{CompiledBinding Translation.SearchSubdirectory.Value,
                     Header="{CompiledBinding Translation.SearchSubdirectory.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsChecked="{Binding GlobalSettings.IsIncludingSubdirectories.Value}"
                     IsChecked="{Binding GlobalSettings.IsIncludingSubdirectories.Value}"
@@ -367,7 +367,7 @@
 
 
                 <!--  Toggle stretching  -->
                 <!--  Toggle stretching  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding StretchCommand}"
+                    Command="{CompiledBinding Tools.StretchCommand}"
                     Header="{CompiledBinding Translation.Stretch.Value,
                     Header="{CompiledBinding Translation.Stretch.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsChecked="{CompiledBinding GlobalSettings.IsStretched.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsStretched.Value}"
@@ -375,7 +375,7 @@
 
 
                 <!--  Toggle side-by-side  -->
                 <!--  Toggle side-by-side  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ShowSideBySideCommand}"
+                    Command="{CompiledBinding Tools.ShowSideBySideCommand}"
                     Header="{CompiledBinding Translation.SideBySide.Value,
                     Header="{CompiledBinding Translation.SideBySide.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide}"
                     IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide}"
@@ -385,7 +385,7 @@
 
 
                 <!--  Toggle topmost  -->
                 <!--  Toggle topmost  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ChangeTopMostCommand}"
+                    Command="{CompiledBinding Tools.ChangeTopMostCommand}"
                     Header="{CompiledBinding Translation.StayTopMost.Value,
                     Header="{CompiledBinding Translation.StayTopMost.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
@@ -393,7 +393,7 @@
 
 
                 <!--  Toggle auto fit  -->
                 <!--  Toggle auto fit  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ChangeAutoFitCommand}"
+                    Command="{CompiledBinding Tools.ChangeAutoFitCommand}"
                     Header="{CompiledBinding Translation.AutoFitWindow.Value,
                     Header="{CompiledBinding Translation.AutoFitWindow.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
@@ -402,11 +402,11 @@
                 <Separator />
                 <Separator />
 
 
                 <!--  Toggle ctrl zoom  -->
                 <!--  Toggle ctrl zoom  -->
-                <MenuItem Command="{CompiledBinding ChangeCtrlZoomCommand}" Header="{CompiledBinding Translation.IsCtrlToZoom.Value, Mode=OneWay}">
+                <MenuItem Command="{CompiledBinding Tools.ChangeCtrlZoomCommand}" Header="{CompiledBinding Translation.IsCtrlToZoom.Value, Mode=OneWay}">
                     <MenuItem.Icon>
                     <MenuItem.Icon>
                         <Image
                         <Image
                             Height="12"
                             Height="12"
-                            Source="{CompiledBinding ChangeCtrlZoomImage}"
+                            Source="{CompiledBinding MainWindow.ChangeCtrlZoomImage}"
                             Width="12" />
                             Width="12" />
                     </MenuItem.Icon>
                     </MenuItem.Icon>
                 </MenuItem>
                 </MenuItem>
@@ -415,7 +415,7 @@
 
 
                 <!--  Toggle UI  -->
                 <!--  Toggle UI  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ToggleUICommand}"
+                    Command="{CompiledBinding Tools.ToggleUICommand}"
                     Header="{CompiledBinding Translation.IsShowingUI.Value,
                     Header="{CompiledBinding Translation.IsShowingUI.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsVisible="{CompiledBinding MainWindow.IsUIShown.Value,
                     IsVisible="{CompiledBinding MainWindow.IsUIShown.Value,
@@ -429,7 +429,7 @@
                 </MenuItem>
                 </MenuItem>
 
 
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ToggleUICommand}"
+                    Command="{CompiledBinding Tools.ToggleUICommand}"
                     Header="{CompiledBinding Translation.IsShowingUI.Value,
                     Header="{CompiledBinding Translation.IsShowingUI.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsVisible="{CompiledBinding !MainWindow.IsUIShown.Value,
                     IsVisible="{CompiledBinding !MainWindow.IsUIShown.Value,
@@ -444,7 +444,7 @@
 
 
                 <!--  Change background  -->
                 <!--  Change background  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ChangeBackgroundCommand}"
+                    Command="{CompiledBinding Tools.ChangeBackgroundCommand}"
                     Header="{CompiledBinding Translation.ChangeBackground.Value,
                     Header="{CompiledBinding Translation.ChangeBackground.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     StaysOpenOnClick="True">
                     StaysOpenOnClick="True">
@@ -478,7 +478,7 @@
 
 
                 <!--  Toggle bottom bar  -->
                 <!--  Toggle bottom bar  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ToggleBottomNavBarCommand}"
+                    Command="{CompiledBinding Tools.ToggleBottomNavBarCommand}"
                     Header="{CompiledBinding Translation.ShowBottomToolbar.Value,
                     Header="{CompiledBinding Translation.ShowBottomToolbar.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsChecked="{CompiledBinding MainWindow.IsBottomToolbarShown.Value}"
                     IsChecked="{CompiledBinding MainWindow.IsBottomToolbarShown.Value}"
@@ -768,10 +768,10 @@
 
 
                 <!--  Optimize image  -->
                 <!--  Optimize image  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding OptimizeImageCommand}"
+                    Command="{CompiledBinding Tools.OptimizeImageCommand}"
                     Header="{CompiledBinding Translation.OptimizeImage.Value,
                     Header="{CompiledBinding Translation.OptimizeImage.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
-                    IsEnabled="{CompiledBinding ShouldOptimizeImageBeEnabled,
+                    IsEnabled="{CompiledBinding GlobalSettings.ShouldOptimizeImageBeEnabled.Value,
                                                 Mode=OneWay}">
                                                 Mode=OneWay}">
                     <MenuItem.Icon>
                     <MenuItem.Icon>
                         <Image
                         <Image
@@ -785,10 +785,10 @@
 
 
                 <!--  Crop  -->
                 <!--  Crop  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding CropCommand}"
+                    Command="{CompiledBinding Tools.CropCommand}"
                     Header="{CompiledBinding Translation.Crop.Value,
                     Header="{CompiledBinding Translation.Crop.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
-                    IsEnabled="{CompiledBinding ShouldCropBeEnabled,
+                    IsEnabled="{CompiledBinding GlobalSettings.ShouldCropBeEnabled.Value,
                                                 Mode=OneWay}"
                                                 Mode=OneWay}"
                     x:Name="CropMenuItem">
                     x:Name="CropMenuItem">
                     <MenuItem.Icon>
                     <MenuItem.Icon>
@@ -805,7 +805,7 @@
 
 
                 <!--  Flip  -->
                 <!--  Flip  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding FlipCommand}"
+                    Command="{CompiledBinding Tools.FlipCommand}"
                     Header="{CompiledBinding Translation.IsFlipped.Value,
                     Header="{CompiledBinding Translation.IsFlipped.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
                     IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
@@ -827,7 +827,7 @@
 
 
                 <!--  Rotate left  -->
                 <!--  Rotate left  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding RotateLeftCommand}"
+                    Command="{CompiledBinding Tools.RotateLeftCommand}"
                     Header="{CompiledBinding Translation.RotateLeft.Value,
                     Header="{CompiledBinding Translation.RotateLeft.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
                     IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
@@ -845,7 +845,7 @@
 
 
                 <!--  Rotate right  -->
                 <!--  Rotate right  -->
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding RotateRightCommand}"
+                    Command="{CompiledBinding Tools.RotateRightCommand}"
                     Header="{CompiledBinding Translation.RotateRight.Value,
                     Header="{CompiledBinding Translation.RotateRight.Value,
                                              Mode=OneWay}"
                                              Mode=OneWay}"
                     IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,
                     IsEnabled="{CompiledBinding PicViewer.ImageSource.Value,

+ 1 - 1
src/PicView.Avalonia/Views/MainView.axaml.cs

@@ -174,7 +174,7 @@ public partial class MainView : UserControl
                 return;
                 return;
             }
             }
             var isNavigatingWithCtrl = Settings.Zoom.CtrlZoom;
             var isNavigatingWithCtrl = Settings.Zoom.CtrlZoom;
-            vm.ChangeCtrlZoomImage = isNavigatingWithCtrl ? leftRightArrowsImage as DrawingImage : scanEyeImage as DrawingImage;
+            vm.MainWindow.ChangeCtrlZoomImage.Value = isNavigatingWithCtrl ? leftRightArrowsImage as DrawingImage : scanEyeImage as DrawingImage;
         });
         });
         
         
         // Update file history menu items in Dispatcher with low priority to avoid slowdown
         // Update file history menu items in Dispatcher with low priority to avoid slowdown

+ 4 - 4
src/PicView.Avalonia/Views/NavigationView.axaml

@@ -26,7 +26,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ToggleSubdirectoriesCommand}"
+            Command="{CompiledBinding Tools.ToggleSubdirectoriesCommand}"
             IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"
             IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">
@@ -43,7 +43,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ToggleLoopingCommand}"
+            Command="{CompiledBinding Tools.ToggleLoopingCommand}"
             IsChecked="{CompiledBinding GlobalSettings.IsLooping.Value}"
             IsChecked="{CompiledBinding GlobalSettings.IsLooping.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             ToolTip.Tip="{CompiledBinding Translation.ToggleLooping.Value,
             ToolTip.Tip="{CompiledBinding Translation.ToggleLooping.Value,
@@ -62,8 +62,8 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ToggleTaskbarProgressCommand}"
-            IsChecked="{CompiledBinding IsShowingTaskbarProgress}"
+            Command="{CompiledBinding Tools.ToggleTaskbarProgressCommand}"
+            IsChecked="{CompiledBinding GlobalSettings.IsShowingTaskbarProgress.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300"
             Width="300"
             x:Name="TaskBarToggleButton">
             x:Name="TaskBarToggleButton">

+ 1 - 1
src/PicView.Avalonia/Views/SettingsView.axaml

@@ -723,7 +723,7 @@
                 </MenuItem.Icon>
                 </MenuItem.Icon>
             </MenuItem>
             </MenuItem>
             <MenuItem
             <MenuItem
-                Command="{CompiledBinding ResetSettingsCommand}"
+                Command="{CompiledBinding Tools.ResetSettingsCommand}"
                 Foreground="{DynamicResource MainTextColor}"
                 Foreground="{DynamicResource MainTextColor}"
                 Header="{CompiledBinding Translation.ResetButtonText.Value,
                 Header="{CompiledBinding Translation.ResetButtonText.Value,
                                          Mode=OneWay}">
                                          Mode=OneWay}">

+ 1 - 1
src/PicView.Avalonia/Views/UC/Buttons/SettingsMenuButton.axaml

@@ -51,7 +51,7 @@
                     </MenuItem.Icon>
                     </MenuItem.Icon>
                 </MenuItem>
                 </MenuItem>
                 <MenuItem
                 <MenuItem
-                    Command="{CompiledBinding ResetSettingsCommand}"
+                    Command="{CompiledBinding Tools.ResetSettingsCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Header="{CompiledBinding Translation.ResetButtonText.Value,
                     Header="{CompiledBinding Translation.ResetButtonText.Value,
                                              Mode=OneWay}">
                                              Mode=OneWay}">

+ 9 - 9
src/PicView.Avalonia/Views/UC/Menus/ImageMenu.axaml

@@ -45,7 +45,7 @@
                     BorderBrush="{DynamicResource MainBorderColor}"
                     BorderBrush="{DynamicResource MainBorderColor}"
                     BorderThickness="0,0,1,0"
                     BorderThickness="0,0,1,0"
                     Classes="hover"
                     Classes="hover"
-                    Command="{CompiledBinding RotateLeftButtonCommand}"
+                    Command="{CompiledBinding Tools.RotateLeftButtonCommand}"
                     CornerRadius="8,0,0,0"
                     CornerRadius="8,0,0,0"
                     Data="{StaticResource RotateLeftGeometry}"
                     Data="{StaticResource RotateLeftGeometry}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
@@ -63,7 +63,7 @@
                     Background="Transparent"
                     Background="Transparent"
                     Canvas.Left="45"
                     Canvas.Left="45"
                     Classes="hover"
                     Classes="hover"
-                    Command="{CompiledBinding RotateRightButtonCommand}"
+                    Command="{CompiledBinding Tools.RotateRightButtonCommand}"
                     Data="{StaticResource RotateRightGeometry}"
                     Data="{StaticResource RotateRightGeometry}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="45"
                     Height="45"
@@ -82,7 +82,7 @@
                     BorderThickness="1,0,1,0"
                     BorderThickness="1,0,1,0"
                     Canvas.Left="90"
                     Canvas.Left="90"
                     Classes="hover"
                     Classes="hover"
-                    Command="{CompiledBinding FlipCommand}"
+                    Command="{CompiledBinding Tools.FlipCommand}"
                     Data="{StaticResource FlipGeometry}"
                     Data="{StaticResource FlipGeometry}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="45"
                     Height="45"
@@ -162,7 +162,7 @@
                             IsTabStop="False"
                             IsTabStop="False"
                             Margin="5,0,0,0"
                             Margin="5,0,0,0"
                             Padding="5,4,0,2"
                             Padding="5,4,0,2"
-                            Text="{CompiledBinding GetIndex,
+                            Text="{CompiledBinding PicViewer.GetIndex.Value,
                                                    Mode=OneWay}"
                                                    Mode=OneWay}"
                             VerticalAlignment="Center"
                             VerticalAlignment="Center"
                             Width="55"
                             Width="55"
@@ -242,9 +242,9 @@
                     Canvas.Left="160"
                     Canvas.Left="160"
                     Canvas.Top="53"
                     Canvas.Top="53"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding CropCommand}"
+                    Command="{CompiledBinding Tools.CropCommand}"
                     Height="46"
                     Height="46"
-                    IsEnabled="{CompiledBinding ShouldCropBeEnabled,
+                    IsEnabled="{CompiledBinding GlobalSettings.ShouldCropBeEnabled.Value,
                                                 Mode=OneWay}"
                                                 Mode=OneWay}"
                     ToolTip.Tip="{CompiledBinding Translation.Crop,
                     ToolTip.Tip="{CompiledBinding Translation.Crop,
                                                   Mode=OneWay}">
                                                   Mode=OneWay}">
@@ -386,11 +386,11 @@
                     Canvas.Left="160"
                     Canvas.Left="160"
                     Canvas.Top="104"
                     Canvas.Top="104"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding ShowSideBySideCommand}"
+                    Command="{CompiledBinding Tools.ShowSideBySideCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     Height="46"
                     IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide.Value}"
                     IsChecked="{CompiledBinding PicViewer.IsShowingSideBySide.Value}"
-                    IsEnabled="{CompiledBinding !IsSingleImage}"
+                    IsEnabled="{CompiledBinding !PicViewer.IsSingleImage.Value}"
                     ToolTip.Tip="{CompiledBinding Translation.SideBySideTooltip.Value}">
                     ToolTip.Tip="{CompiledBinding Translation.SideBySideTooltip.Value}">
                     <TextBlock
                     <TextBlock
                         Classes="txt btnTxt"
                         Classes="txt btnTxt"
@@ -406,7 +406,7 @@
                     Command="{CompiledBinding Gallery.ToggleBottomGalleryCommand}"
                     Command="{CompiledBinding Gallery.ToggleBottomGalleryCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     Height="46"
-                    IsEnabled="{CompiledBinding !IsSingleImage}"
+                    IsEnabled="{CompiledBinding !PicViewer.IsSingleImage.Value}"
                     ToolTip.Tip="{CompiledBinding Translation.IsShowingBottomGallery.Value,
                     ToolTip.Tip="{CompiledBinding Translation.IsShowingBottomGallery.Value,
                                                   Mode=OneWay}"
                                                   Mode=OneWay}"
                     Width="300">
                     Width="300">

+ 5 - 5
src/PicView.Avalonia/Views/UC/Menus/SettingsMenu.axaml

@@ -126,7 +126,7 @@
                     Canvas.Left="7"
                     Canvas.Left="7"
                     Canvas.Top="53"
                     Canvas.Top="53"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding ToggleScrollCommand}"
+                    Command="{CompiledBinding Tools.ToggleScrollCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     Height="46"
                     IsChecked="{CompiledBinding GlobalSettings.IsScrollingEnabled.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsScrollingEnabled.Value}"
@@ -157,7 +157,7 @@
                     Canvas.Left="7"
                     Canvas.Left="7"
                     Canvas.Top="104"
                     Canvas.Top="104"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding ToggleLoopingCommand}"
+                    Command="{CompiledBinding Tools.ToggleLoopingCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     Height="46"
                     IsChecked="{CompiledBinding GlobalSettings.IsLooping.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsLooping.Value}"
@@ -172,7 +172,7 @@
                     Canvas.Left="182"
                     Canvas.Left="182"
                     Canvas.Top="104"
                     Canvas.Top="104"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding ChangeAutoFitCommand}"
+                    Command="{CompiledBinding Tools.ChangeAutoFitCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     Height="46"
                     IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
@@ -187,7 +187,7 @@
                     Canvas.Left="7"
                     Canvas.Left="7"
                     Canvas.Top="155"
                     Canvas.Top="155"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{Binding ChangeTopMostCommand}"
+                    Command="{Binding Tools.ChangeTopMostCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     Height="46"
                     IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
@@ -202,7 +202,7 @@
                     Canvas.Left="182"
                     Canvas.Left="182"
                     Canvas.Top="155"
                     Canvas.Top="155"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding ToggleSubdirectoriesCommand}"
+                    Command="{CompiledBinding Tools.ToggleSubdirectoriesCommand}"
                     Foreground="{DynamicResource MainTextColor}"
                     Foreground="{DynamicResource MainTextColor}"
                     Height="46"
                     Height="46"
                     IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"
                     IsChecked="{CompiledBinding GlobalSettings.IsIncludingSubdirectories.Value}"

+ 4 - 4
src/PicView.Avalonia/Views/UC/Menus/ToolsMenu.axaml

@@ -153,9 +153,9 @@
                     Canvas.Left="182"
                     Canvas.Left="182"
                     Canvas.Top="53"
                     Canvas.Top="53"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding OptimizeImageCommand}"
+                    Command="{CompiledBinding Tools.OptimizeImageCommand}"
                     Height="46"
                     Height="46"
-                    IsEnabled="{CompiledBinding ShouldOptimizeImageBeEnabled,
+                    IsEnabled="{CompiledBinding GlobalSettings.ShouldOptimizeImageBeEnabled.Value,
                                                 Mode=OneWay}"
                                                 Mode=OneWay}"
                     ToolTip.Tip="{CompiledBinding Translation.OptimizeImage.Value,
                     ToolTip.Tip="{CompiledBinding Translation.OptimizeImage.Value,
                                                   Mode=OneWay}"
                                                   Mode=OneWay}"
@@ -198,7 +198,7 @@
                     Canvas.Left="182"
                     Canvas.Left="182"
                     Canvas.Top="104"
                     Canvas.Top="104"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding ChangeBackgroundCommand}"
+                    Command="{CompiledBinding Tools.ChangeBackgroundCommand}"
                     Height="46"
                     Height="46"
                     Width="169">
                     Width="169">
                     <StackPanel Orientation="Horizontal">
                     <StackPanel Orientation="Horizontal">
@@ -236,7 +236,7 @@
                     Canvas.Left="182"
                     Canvas.Left="182"
                     Canvas.Top="155"
                     Canvas.Top="155"
                     Classes="ButtonBorder altHover"
                     Classes="ButtonBorder altHover"
-                    Command="{CompiledBinding ToggleUICommand}"
+                    Command="{CompiledBinding Tools.ToggleUICommand}"
                     Height="46"
                     Height="46"
                     Width="169">
                     Width="169">
                     <StackPanel Orientation="Horizontal">
                     <StackPanel Orientation="Horizontal">

+ 3 - 3
src/PicView.Avalonia/Views/WindowSettingsView.axaml

@@ -28,7 +28,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ChangeAutoFitCommand}"
+            Command="{CompiledBinding Tools.ChangeAutoFitCommand}"
             IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
             IsChecked="{CompiledBinding GlobalSettings.IsAutoFit.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">
@@ -85,7 +85,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover alt changeColor"
             Classes="altHover alt changeColor"
-            Command="{CompiledBinding ChangeTopMostCommand}"
+            Command="{CompiledBinding Tools.ChangeTopMostCommand}"
             IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
             IsChecked="{CompiledBinding GlobalSettings.IsTopMost.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">
@@ -122,7 +122,7 @@
             Background="Transparent"
             Background="Transparent"
             BorderThickness="0"
             BorderThickness="0"
             Classes="altHover changeColor"
             Classes="altHover changeColor"
-            Command="{CompiledBinding ToggleOpeningInSameWindowCommand}"
+            Command="{CompiledBinding Tools.ToggleOpeningInSameWindowCommand}"
             IsChecked="{CompiledBinding SettingsViewModel.IsOpeningInSameWindow.Value}"
             IsChecked="{CompiledBinding SettingsViewModel.IsOpeningInSameWindow.Value}"
             Margin="0,0,0,10"
             Margin="0,0,0,10"
             Width="300">
             Width="300">

+ 6 - 0
src/PicView.Core/ViewModels/GlobalSettingsViewModel.cs

@@ -20,4 +20,10 @@ public class GlobalSettingsViewModel
     public BindableReactiveProperty<double> RotationAngle { get; } = new(0);
     public BindableReactiveProperty<double> RotationAngle { get; } = new(0);
 
 
     public BindableReactiveProperty<double> ZoomValue { get; } = new();
     public BindableReactiveProperty<double> ZoomValue { get; } = new();
+    
+    public BindableReactiveProperty<bool> ShouldCropBeEnabled { get; } = new();
+    
+    public BindableReactiveProperty<bool> ShouldOptimizeImageBeEnabled { get; } = new();
+    
+    public BindableReactiveProperty<bool> IsShowingTaskbarProgress { get; } = new(Settings.UIProperties.IsTaskbarProgressEnabled);
 }
 }

+ 3 - 0
src/PicView.Core/ViewModels/PicViewerModel.cs

@@ -68,4 +68,7 @@ public class PicViewerModel : IDisposable
     public BindableReactiveProperty<string> WindowTitle { get; } = new();
     public BindableReactiveProperty<string> WindowTitle { get; } = new();
     
     
     public BindableReactiveProperty<int> Index { get; } = new();
     public BindableReactiveProperty<int> Index { get; } = new();
+    public BindableReactiveProperty<int> GetIndex { get; } = new();
+    
+    public BindableReactiveProperty<bool> IsSingleImage { get; } = new();
 }
 }