Sfoglia il codice sorgente

Yet another sanitary clean-up

Ruben 5 anni fa
parent
commit
bffd3d8d35
100 ha cambiato i file con 560 aggiunte e 596 eliminazioni
  1. 2 2
      PicView/App.config
  2. 1 1
      PicView/App.xaml
  3. 2 3
      PicView/App.xaml.cs
  4. 2 5
      PicView/ChangeImage/Error_Handling.cs
  5. 1 2
      PicView/ChangeImage/GoToLogic.cs
  6. 1 2
      PicView/ChangeImage/LoadFromWeb.cs
  7. 29 31
      PicView/ChangeImage/Navigation.cs
  8. 7 17
      PicView/ChangeImage/Preloader.cs
  9. 12 14
      PicView/Editing/Batch_Resize.cs
  10. 2 5
      PicView/Editing/ImageCropping.cs
  11. 0 3
      PicView/FileHandling/ArchiveExtraction.cs
  12. 4 7
      PicView/FileHandling/Copy-paste.cs
  13. 3 4
      PicView/FileHandling/DeleteFiles.cs
  14. 16 22
      PicView/FileHandling/FileFunctions.cs
  15. 16 4
      PicView/FileHandling/FileLists.cs
  16. 6 7
      PicView/FileHandling/Open_Save.cs
  17. 2 7
      PicView/FileHandling/RecentFiles.cs
  18. 9 11
      PicView/FileHandling/SupportedFiles.cs
  19. 3 4
      PicView/GlobalSuppressions.cs
  20. 1 1
      PicView/ImageHandling/Base64.cs
  21. 10 8
      PicView/ImageHandling/Thumbnails.cs
  22. 4 14
      PicView/Library/Fields.cs
  23. 3 3
      PicView/Library/Resources/DrawingBrushes.cs
  24. 4 9
      PicView/Library/Resources/SvgIcons.cs
  25. 3 3
      PicView/Library/Resources/Timers.cs
  26. 3 36
      PicView/Library/Utilities.cs
  27. 1 1
      PicView/PicView.csproj
  28. 9 12
      PicView/Properties/AssemblyInfo.cs
  29. 2 3
      PicView/Shortcuts/CustomTextBoxShortcuts.cs
  30. 6 6
      PicView/Shortcuts/GotoPicsShortcuts.cs
  31. 11 11
      PicView/Shortcuts/MainShortcuts.cs
  32. 5 7
      PicView/SystemIntegration/MonitorSize.cs
  33. 16 13
      PicView/SystemIntegration/NativeMethods.cs
  34. 32 0
      PicView/SystemIntegration/Taskbar.cs
  35. 20 24
      PicView/SystemIntegration/Wallpaper.cs
  36. 89 13
      PicView/UI/Animations/AnimationHelper.cs
  37. 1 2
      PicView/UI/Animations/FadeControls.cs
  38. 6 10
      PicView/UI/Animations/MouseOverAnimations.cs
  39. 40 25
      PicView/UI/ConfigColors.cs
  40. 3 5
      PicView/UI/DragAndDrop.cs
  41. 1 2
      PicView/UI/EditTitleBar.cs
  42. 5 13
      PicView/UI/HideInterfaceLogic.cs
  43. 1 1
      PicView/UI/Loading/AjaxLoader.cs
  44. 4 3
      PicView/UI/Loading/EventsHandling.cs
  45. 13 24
      PicView/UI/Loading/LoadContextMenus.cs
  46. 0 3
      PicView/UI/Loading/LoadControls.cs
  47. 1 1
      PicView/UI/Loading/LoadWindows.cs
  48. 2 3
      PicView/UI/Loading/StartLoading.cs
  49. 5 7
      PicView/UI/PicGallery/GalleryClick.cs
  50. 9 9
      PicView/UI/PicGallery/GalleryFunctions.cs
  51. 1 2
      PicView/UI/PicGallery/GalleryLoad.cs
  52. 7 9
      PicView/UI/PicGallery/GalleryScroll.cs
  53. 13 15
      PicView/UI/PicGallery/GalleryToggle.cs
  54. 1 1
      PicView/UI/SetTitle.cs
  55. 5 6
      PicView/UI/Sizing/ScaleImage.cs
  56. 5 11
      PicView/UI/Sizing/WindowLogic.cs
  57. 7 6
      PicView/UI/SlideShow.cs
  58. 0 1
      PicView/UI/Styles/Backgrounds.xaml
  59. 0 2
      PicView/UI/Styles/Border.xaml
  60. 0 2
      PicView/UI/Styles/Button.xaml
  61. 0 6
      PicView/UI/Styles/Colors.xaml
  62. 1 1
      PicView/UI/Styles/FlatSlider.xaml
  63. 1 2
      PicView/UI/Styles/Menu.xaml
  64. 0 1
      PicView/UI/Styles/MyWindowStyle.xaml
  65. 0 2
      PicView/UI/Styles/ProgressBar.xaml
  66. 0 6
      PicView/UI/Styles/RadioButton.xaml
  67. 0 1
      PicView/UI/Styles/ScrollBar.xaml
  68. 0 2
      PicView/UI/Styles/Separator.xaml
  69. 0 1
      PicView/UI/Styles/Slider.xaml
  70. 1 1
      PicView/UI/Styles/TabControl.xaml
  71. 0 1
      PicView/UI/Styles/TextBox.xaml
  72. 0 3
      PicView/UI/Styles/ToggleButton.xaml
  73. 16 14
      PicView/UI/Styles/ToolBar.xaml
  74. 1 2
      PicView/UI/Styles/ToolTip.xaml
  75. 1 2
      PicView/UI/Tooltip.cs
  76. 1 3
      PicView/UI/TransformImage/Rotation.cs
  77. 1 1
      PicView/UI/TransformImage/Scroll.cs
  78. 35 11
      PicView/UI/TransformImage/Zoom.cs
  79. 15 11
      PicView/UI/UpdateUIValues.cs
  80. 2 2
      PicView/UI/UserControls/Buttons/ClickArrow.xaml
  81. 0 3
      PicView/UI/UserControls/Buttons/ClickArrow.xaml.cs
  82. 1 1
      PicView/UI/UserControls/Buttons/CloseButton.xaml
  83. 1 3
      PicView/UI/UserControls/Buttons/CloseButton.xaml.cs
  84. 1 1
      PicView/UI/UserControls/Buttons/FullscreenButton.xaml
  85. 1 1
      PicView/UI/UserControls/Buttons/FullscreenButton.xaml.cs
  86. 1 4
      PicView/UI/UserControls/Buttons/GalleryShortcut.xaml.cs
  87. 1 1
      PicView/UI/UserControls/Buttons/MenuCloseButton.xaml
  88. 1 1
      PicView/UI/UserControls/Buttons/MenuCloseButton.xaml.cs
  89. 1 1
      PicView/UI/UserControls/Buttons/MinButton.xaml
  90. 1 3
      PicView/UI/UserControls/Buttons/MinButton.xaml.cs
  91. 1 1
      PicView/UI/UserControls/Buttons/Minus.xaml
  92. 1 4
      PicView/UI/UserControls/Buttons/Minus.xaml.cs
  93. 1 1
      PicView/UI/UserControls/Buttons/X2.xaml
  94. 1 4
      PicView/UI/UserControls/Buttons/X2.xaml.cs
  95. 0 1
      PicView/UI/UserControls/Gallery/PicGallery.xaml.cs
  96. 1 1
      PicView/UI/UserControls/Gallery/PicGalleryItem.xaml
  97. 1 1
      PicView/UI/UserControls/Gallery/PicGalleryItem.xaml.cs
  98. 1 3
      PicView/UI/UserControls/Menus/FileMenu.xaml
  99. 1 1
      PicView/UI/UserControls/Menus/FileMenu.xaml.cs
  100. 1 9
      PicView/UI/UserControls/Menus/ImageSettings.xaml

+ 2 - 2
PicView/App.config

@@ -5,7 +5,7 @@
             <section name="PicView.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
         </sectionGroup>
     </configSections>
-    <startup> 
+    <startup>
         <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
     </startup>
     <userSettings>
@@ -154,4 +154,4 @@
       </dependentAssembly>
     </assemblyBinding>
   </runtime>
-</configuration>
+</configuration>

+ 1 - 1
PicView/App.xaml

@@ -69,4 +69,4 @@
     <JumpList.JumpList>
         <JumpList ShowFrequentCategory="True" ShowRecentCategory="False" />
     </JumpList.JumpList>
-</Application>
+</Application>

+ 2 - 3
PicView/App.xaml.cs

@@ -1,5 +1,4 @@
-using System;
-using System.Windows;
+using System.Windows;
 
 namespace PicView
 {
@@ -23,4 +22,4 @@ namespace PicView
             System.Runtime.ProfileOptimization.StartProfile("ProfileOptimization");
         }
     }
-}
+}

+ 2 - 5
PicView/ChangeImage/Error_Handling.cs

@@ -12,7 +12,6 @@ using static PicView.FileHandling.DeleteFiles;
 using static PicView.FileHandling.FileLists;
 using static PicView.ImageHandling.ImageDecoder;
 using static PicView.Library.Fields;
-using static PicView.Library.Utilities;
 using static PicView.UI.Loading.AjaxLoader;
 using static PicView.UI.Tooltip;
 using static PicView.UI.TransformImage.Rotation;
@@ -148,8 +147,6 @@ namespace PicView.ChangeImage
             return null;
         }
 
-
-
         /// <summary>
         /// Clears data, to free objects no longer necessary to store in memory and allow changing folder without error.
         /// </summary>
@@ -265,7 +262,7 @@ namespace PicView.ChangeImage
                 TempZipPath = string.Empty;
             }
 
-            NoProgress();
+            SystemIntegration.Taskbar.NoProgress();
             AnimationHelper.Fade(ajaxLoading, 0, TimeSpan.FromSeconds(.2));
         }
 
@@ -298,4 +295,4 @@ namespace PicView.ChangeImage
             IsUnsupported = true;
         }
     }
-}
+}

+ 1 - 2
PicView/ChangeImage/GoToLogic.cs

@@ -25,7 +25,6 @@ namespace PicView.ChangeImage
                 quickSettingsMenu.GoToPicBox.Text = FolderIndex.ToString(CultureInfo.CurrentCulture);
                 // TODO add error message or something..
             }
-
         }
 
         internal static void ClearGoTo()
@@ -38,4 +37,4 @@ namespace PicView.ChangeImage
             AjaxLoader.AjaxLoadingEnd();
         }
     }
-}
+}

+ 1 - 2
PicView/ChangeImage/LoadFromWeb.cs

@@ -42,7 +42,6 @@ namespace PicView.ChangeImage
             {
                 pic = await LoadImageWebAsync(path).ConfigureAwait(true);
             }
-
             catch (Exception e)
             {
 #if DEBUG
@@ -100,4 +99,4 @@ namespace PicView.ChangeImage
             return pic;
         }
     }
-}
+}

+ 29 - 31
PicView/ChangeImage/Navigation.cs

@@ -1,5 +1,6 @@
 using PicView.FileHandling;
 using PicView.ImageHandling;
+using PicView.SystemIntegration;
 using PicView.UI.PicGallery;
 using System;
 using System.Diagnostics;
@@ -13,7 +14,6 @@ using static PicView.FileHandling.FileLists;
 using static PicView.ImageHandling.ImageDecoder;
 using static PicView.ImageHandling.Thumbnails;
 using static PicView.Library.Fields;
-using static PicView.Library.Utilities;
 using static PicView.UI.Loading.AjaxLoader;
 using static PicView.UI.SetTitle;
 using static PicView.UI.Sizing.ScaleImage;
@@ -26,6 +26,7 @@ namespace PicView.ChangeImage
     internal static class Navigation
     {
         #region Update Image values
+
         /// <summary>
         /// Loads a picture from a given file path and does extra error checking
         /// </summary>
@@ -123,7 +124,6 @@ namespace PicView.ChangeImage
             AjaxLoadingEnd();
 
             prevPicResource = null; // Make sure to not waste memory
-
         }
 
         /// <summary>
@@ -132,6 +132,11 @@ namespace PicView.ChangeImage
         /// <param name="x">The index of file to load from Pics</param>
         internal static async void Pic(int x)
         {
+#if DEBUG
+            var stopWatch = new Stopwatch();
+            stopWatch.Start();
+#endif
+
             BitmapSource pic;
 
             // Clear unsupported image window, if shown
@@ -141,7 +146,7 @@ namespace PicView.ChangeImage
                 badImage = null;
                 IsUnsupported = false;
             }
-            
+
             if (Pics.Count <= x)
             {
                 pic = await PicErrorFix(x).ConfigureAwait(true);
@@ -163,7 +168,7 @@ namespace PicView.ChangeImage
             {
                 mainWindow.Title = Loading;
                 mainWindow.Bar.Text = Loading;
-                mainWindow.Bar.ToolTip = Loading;               
+                mainWindow.Bar.ToolTip = Loading;
 
                 var thumb = GetThumb(x, true);
 
@@ -192,7 +197,7 @@ namespace PicView.ChangeImage
 
                     do
                     {
-                        // Try again while loading                                             
+                        // Try again while loading
                         pic = Preloader.Load(Pics[x]);
                         await Task.Delay(3).ConfigureAwait(true);
                     } while (Preloader.IsLoading);
@@ -238,7 +243,7 @@ namespace PicView.ChangeImage
 
             if (Pics.Count > 1)
             {
-                Progress(x, Pics.Count);
+                SystemIntegration.Taskbar.Progress(x, Pics.Count);
 
                 // Preload images \\
                 if (Preloader.StartPreload())
@@ -261,8 +266,15 @@ namespace PicView.ChangeImage
                     prevPicResource = null;
                 }
             }
-            
+
             FreshStartup = false;
+
+#if DEBUG
+            stopWatch.Stop();
+            var s = $"Pic(); executed in {stopWatch.Elapsed.TotalMilliseconds} milliseconds";
+            Trace.WriteLine(s);
+            //ToolTipStyle(s);
+#endif
         }
 
         /// <summary>
@@ -288,7 +300,7 @@ namespace PicView.ChangeImage
 
             SetTitleString(pic.PixelWidth, pic.PixelHeight, imageName);
 
-            NoProgress();
+            Taskbar.NoProgress();
 
             CanNavigate = false;
         }
@@ -316,7 +328,7 @@ namespace PicView.ChangeImage
 
             SetTitleString(pic.PixelWidth, pic.PixelHeight, "Base64 image");
 
-            NoProgress();
+            Taskbar.NoProgress();
 
             CanNavigate = false;
         }
@@ -325,7 +337,7 @@ namespace PicView.ChangeImage
         {
             ChangeFolder(true);
             Pics = FileList(folder);
-            
+
             Pic(0);
 
             quickSettingsMenu.GoToPicBox.Text = (FolderIndex + 1).ToString(CultureInfo.CurrentCulture);
@@ -333,12 +345,11 @@ namespace PicView.ChangeImage
             AjaxLoadingEnd();
 
             prevPicResource = null; // Make sure to not waste memory
-
         }
 
-        #endregion
+        #endregion Update Image values
 
-        #region Change navigation values 
+        #region Change navigation values
 
         /// <summary>
         /// Goes to next, previous, first or last file in folder
@@ -348,12 +359,6 @@ namespace PicView.ChangeImage
         /// depending on the next value</param>
         internal static void Pic(bool next = true, bool end = false)
         {
-
-#if DEBUG
-            var stopWatch = new Stopwatch();
-            stopWatch.Start();
-#endif
-
             // Exit if not intended to change picture
             if (!CanNavigate)
             {
@@ -457,16 +462,9 @@ namespace PicView.ChangeImage
                     // TODO Find way to get PicGalleryItem an alternative way...
                 }
             }
-
-#if DEBUG
-            stopWatch.Stop();
-            var s = "Pic(); executed in " + stopWatch.Elapsed.TotalMilliseconds + " milliseconds";
-            Trace.WriteLine(s);
-            //ToolTipStyle(s);
-#endif
         }
 
-        internal static void PicButton(bool arrow , bool right)
+        internal static void PicButton(bool arrow, bool right)
         {
             if (arrow)
             {
@@ -522,7 +520,7 @@ namespace PicView.ChangeImage
             /// Need solution for slowing down this thing to something useful
             /// await task delay only works once, it seems
             /// Timers doesn't deliver a proper result in my experience
-            /// 
+            ///
 
             FastPicRunning = true;
 
@@ -563,7 +561,7 @@ namespace PicView.ChangeImage
                 mainWindow.img.Source = thumb;
             }
 
-            Progress(FolderIndex, Pics.Count);
+            Taskbar.Progress(FolderIndex, Pics.Count);
         }
 
         /// <summary>
@@ -587,6 +585,6 @@ namespace PicView.ChangeImage
             Pic(FolderIndex);
         }
 
-        #endregion
+        #endregion Change navigation values
     }
-}
+}

+ 7 - 17
PicView/ChangeImage/Preloader.cs

@@ -28,7 +28,6 @@ namespace PicView.ChangeImage
             return false;
         }
 
-
         /// <summary>
         /// Preloader list of BitmapSources
         /// </summary>
@@ -56,7 +55,6 @@ namespace PicView.ChangeImage
                 return IsLoading = false;
             }
 
-
             IsLoading = true;
 
             var pic = await ImageDecoder.RenderToBitmapSource(file).ConfigureAwait(true);
@@ -77,7 +75,6 @@ namespace PicView.ChangeImage
 #endif
 
             return Sources.TryAdd(file, pic);
-
         }
 
         /// <summary>
@@ -93,9 +90,9 @@ namespace PicView.ChangeImage
 
             IsLoading = true;
 
-//#if DEBUG
-//            System.Threading.Thread.Sleep(1000);
-//#endif
+            //#if DEBUG
+            //            System.Threading.Thread.Sleep(1000);
+            //#endif
 
             if (File.Exists(Pics[i]))
             {
@@ -103,7 +100,6 @@ namespace PicView.ChangeImage
                 {
                     return await Add(Pics[i]).ConfigureAwait(true);
                 }
-
                 else
                 {
 #if DEBUG
@@ -111,12 +107,11 @@ namespace PicView.ChangeImage
 #endif
                     return false;
                 }
-
             }
             else
             {
                 Pics.Remove(Pics[i]);
-                
+
 #if DEBUG
                 Trace.WriteLine("Preloader removed = " + Pics[i] + " from Pics, index " + i);
 #endif
@@ -166,7 +161,6 @@ namespace PicView.ChangeImage
 #else
             Sources.TryAdd(key, bmp);
 #endif
-
         }
 
         /// <summary>
@@ -227,7 +221,7 @@ namespace PicView.ChangeImage
         }
 
         /// <summary>
-        /// Removes all keys 
+        /// Removes all keys
         /// </summary>
         internal static void Clear()
         {
@@ -289,7 +283,6 @@ namespace PicView.ChangeImage
             return Sources.ContainsKey(key);
         }
 
-
         internal static async void PreloaderFix(string file)
         {
             if (!Contains(file))
@@ -300,7 +293,6 @@ namespace PicView.ChangeImage
             }
         }
 
-
         /// <summary>
         /// Starts decoding images into memory,
         /// based on current index and if reverse or not
@@ -315,7 +307,7 @@ namespace PicView.ChangeImage
                 + string.Concat(Reverse ? "backwards" : "forwards"));
 #endif
 
-            return Task.Run(async() =>
+            return Task.Run(async () =>
             {
                 var toLoad = 8;
                 var extraToLoad = toLoad / 2;
@@ -475,9 +467,7 @@ namespace PicView.ChangeImage
                 }
 
                 IsLoading = false; // Fixes loading erros
-
             });
         }
     }
-
-}
+}

+ 12 - 14
PicView/Editing/Batch_Resize.cs

@@ -14,8 +14,8 @@ namespace PicView.Editing
 {
     internal static class Batch_Resize
     {
-        static int rotation, quality, width, height;
-        static bool rename, aspectRatio, optimize, flip, resize = false;
+        private static int rotation, quality, width, height;
+        private static bool rename, aspectRatio, optimize, flip, resize = false;
         private static string name;
         private static string destinationFolder;
         private static string sourceFolder;
@@ -49,7 +49,7 @@ namespace PicView.Editing
             var progress = new Progress<string>();
             progress.ProgressChanged += Progress_ProgressChanged;
 
-            var currentFolder = Path.GetDirectoryName(Pics[FolderIndex]);           
+            var currentFolder = Path.GetDirectoryName(Pics[FolderIndex]);
 
             if (currentFolder != sourceFolder)
             {
@@ -198,16 +198,14 @@ namespace PicView.Editing
                 }
             }).ConfigureAwait(false);
 
-        //await Task.Run(() =>
-        //Parallel.For(0, files.Count, (i, state) =>
-        //{
-        //    var x = ImageDecoder.TransformImage(files[i], resize, width, height, aspectRatio, rotation, quality, optimize, flip, name, destination);
-        //    progress.Report(x);
-        //    cancellationToken.ThrowIfCancellationRequested();
-
-        //})).ConfigureAwait(false);
-    }
-
+            //await Task.Run(() =>
+            //Parallel.For(0, files.Count, (i, state) =>
+            //{
+            //    var x = ImageDecoder.TransformImage(files[i], resize, width, height, aspectRatio, rotation, quality, optimize, flip, name, destination);
+            //    progress.Report(x);
+            //    cancellationToken.ThrowIfCancellationRequested();
 
+            //})).ConfigureAwait(false);
+        }
     }
-}
+}

+ 2 - 5
PicView/Editing/ImageCropping.cs

@@ -1,5 +1,4 @@
-using ImageMagick;
-using Microsoft.Win32;
+using Microsoft.Win32;
 using PicView.ImageHandling;
 using PicView.UI;
 using PicView.UI.Loading;
@@ -65,7 +64,6 @@ namespace PicView.Editing
                 cropppingTool.CropTool.Width = xHeight;
                 cropppingTool.CropTool.Height = xWidth;
             }
-
         }
 
         internal static async void SaveCrop()
@@ -128,7 +126,6 @@ namespace PicView.Editing
                     width = Convert.ToInt32(cropArea.CroppedRectAbsolute.Height / AspectRatio);
                     height = Convert.ToInt32(cropArea.CroppedRectAbsolute.Width / AspectRatio);
                 }
-
             }
             else
             {
@@ -151,4 +148,4 @@ namespace PicView.Editing
             return new Int32Rect(x, y, width, height);
         }
     }
-}
+}

+ 0 - 3
PicView/FileHandling/ArchiveExtraction.cs

@@ -26,7 +26,6 @@ namespace PicView.FileHandling
                 DeleteTempFiles();
             }
 
-
             // TODO find a way to make user set path and app
             // if installed in irregular way
 
@@ -108,7 +107,6 @@ namespace PicView.FileHandling
                 return false;
             }
 
-
             //return SetDirectory(path);
             return true;
         }
@@ -167,7 +165,6 @@ namespace PicView.FileHandling
         /// </summary>
         internal static async Task<bool> RecoverFailedArchiveAsync()
         {
-
 #if DEBUG
             Trace.WriteLine("Entered RecoverFailedArchiveAsync");
 #endif

+ 4 - 7
PicView/FileHandling/Copy-paste.cs

@@ -1,4 +1,5 @@
 using PicView.ChangeImage;
+using PicView.ImageHandling;
 using System;
 using System.Diagnostics;
 using System.IO;
@@ -7,12 +8,11 @@ using System.Reflection;
 using System.Windows;
 using System.Windows.Media.Imaging;
 using static PicView.ChangeImage.Error_Handling;
-using static PicView.Library.Fields;
+using static PicView.ChangeImage.Navigation;
 using static PicView.FileHandling.FileFunctions;
 using static PicView.FileHandling.FileLists;
-using static PicView.ChangeImage.Navigation;
+using static PicView.Library.Fields;
 using static PicView.UI.Tooltip;
-using PicView.ImageHandling;
 
 namespace PicView.FileHandling
 {
@@ -86,7 +86,6 @@ namespace PicView.FileHandling
             ShowTooltipMessage("Copied Image to clipboard");
         }
 
-
         /// <summary>
         /// Retrieves the data from the clipboard and attemps to load image, if possible
         /// </summary>
@@ -108,8 +107,6 @@ namespace PicView.FileHandling
                         // If from same folder
                         if (!string.IsNullOrWhiteSpace(Pics[FolderIndex]) && Path.GetDirectoryName(x) == Path.GetDirectoryName(Pics[FolderIndex]))
                         {
-
-
                             Pic(Pics.IndexOf(x));
                         }
                         else
@@ -230,4 +227,4 @@ namespace PicView.FileHandling
             ShowTooltipMessage(ImageCut);
         }
     }
-}
+}

+ 3 - 4
PicView/FileHandling/DeleteFiles.cs

@@ -3,9 +3,9 @@ using System;
 using System.Diagnostics;
 using System.IO;
 using static PicView.ChangeImage.Error_Handling;
-using static PicView.Library.Fields;
-using static PicView.FileHandling.FileFunctions;
 using static PicView.ChangeImage.Navigation;
+using static PicView.FileHandling.FileFunctions;
+using static PicView.Library.Fields;
 using static PicView.UI.Tooltip;
 
 namespace PicView.FileHandling
@@ -106,7 +106,6 @@ namespace PicView.FileHandling
             PreloadCount = Reverse ? PreloadCount - 1 : PreloadCount + 1;
 
             Pic(Reverse);
-
         }
     }
-}
+}

+ 16 - 22
PicView/FileHandling/FileFunctions.cs

@@ -6,9 +6,8 @@ using System.Text.RegularExpressions;
 
 namespace PicView.FileHandling
 {
-    class FileFunctions
+    internal class FileFunctions
     {
-
         internal static bool RenameFile(string path, string newPath)
         {
             try
@@ -25,50 +24,47 @@ namespace PicView.FileHandling
             return true;
         }
 
-
-
         /// <summary>
-        /// Returns the human-readable file size for an arbitrary, 64-bit file size 
+        /// Returns the human-readable file size for an arbitrary, 64-bit file size
         /// The default format is "0.### XB", e.g. "4.2 KB" or "1.434 GB"
         /// </summary>
         /// <param name="i">FileInfo.Length</param>
         /// <returns></returns>
         /// Credits to http://www.somacon.com/p576.php
-        [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0059:Unnecessary assignment of a value", Justification = "<Pending>")]
         internal static string GetSizeReadable(long i)
         {
-            string sign = (i < 0 ? "-" : string.Empty);
-            double readable = i < 0 ? -i : i;
-            char suffix;
+            string sign = i < 0 ? "-" : string.Empty;
+            _ = i < 0 ? -i : i;
+            char prefix;
+            double value;
 
             if (i >= 0x40000000) // Gigabyte
             {
-                suffix = 'G';
-                readable = (i >> 20);
+                prefix = 'G';
+                value = i >> 20;
             }
             else if (i >= 0x100000) // Megabyte
             {
-                suffix = 'M';
-                readable = (i >> 10);
+                prefix = 'M';
+                value = i >> 10;
             }
             else if (i >= 0x400) // Kilobyte
             {
-                suffix = 'K';
-                readable = i;
+                prefix = 'K';
+                value = i;
             }
             else
             {
                 return i.ToString(sign + "0 B", CultureInfo.CurrentCulture); // Byte
             }
-            readable /= 1024;
+            value /= 1024;
 
-            return sign + readable.ToString("0.## ", CultureInfo.CurrentCulture) + suffix + 'B';
+            return sign + value.ToString("0.## ", CultureInfo.CurrentCulture) + prefix + 'B';
         }
 
-
         internal static bool FilePathHasInvalidChars(string path)
         {
-            return (!string.IsNullOrEmpty(path) && path.IndexOfAny(Path.GetInvalidPathChars()) >= 0);
+            return !string.IsNullOrEmpty(path) && path.IndexOfAny(Path.GetInvalidPathChars()) >= 0;
         }
 
         internal static string MakeValidFileName(string name)
@@ -89,6 +85,4 @@ namespace PicView.FileHandling
             return name;
         }
     }
-
-
-}
+}

+ 16 - 4
PicView/FileHandling/FileLists.cs

@@ -33,18 +33,25 @@ namespace PicView.FileHandling
             {
                 case 0:
                     return FileList(path, SortFilesBy.Name);
+
                 case 1:
                     return FileList(path, SortFilesBy.FileSize);
+
                 case 2:
                     return FileList(path, SortFilesBy.Creationtime);
+
                 case 3:
                     return FileList(path, SortFilesBy.Extension);
+
                 case 4:
                     return FileList(path, SortFilesBy.Lastaccesstime);
+
                 case 5:
                     return FileList(path, SortFilesBy.Lastwritetime);
+
                 case 6:
                     return FileList(path, SortFilesBy.Random);
+
                 default:
                     return FileList(path, SortFilesBy.Name);
             }
@@ -68,7 +75,7 @@ namespace PicView.FileHandling
                 .AsParallel()
                 .Where(file =>
 
-                        // Standards
+                           // Standards
                            file.ToLower(CultureInfo.CurrentCulture).EndsWith("jpg", StringComparison.OrdinalIgnoreCase)
                         || file.ToLower(CultureInfo.CurrentCulture).EndsWith("jpeg", StringComparison.OrdinalIgnoreCase)
                         || file.ToLower(CultureInfo.CurrentCulture).EndsWith("jpe", StringComparison.OrdinalIgnoreCase)
@@ -137,23 +144,29 @@ namespace PicView.FileHandling
                 // Alphanumeric sort
                 case SortFilesBy.Name:
                     var list = items.ToList();
-                    list.Sort((x, y) => { return NativeMethods.StrCmpLogicalW(x, y); });
+                    list.Sort((x, y) => { return SystemIntegration.NativeMethods.StrCmpLogicalW(x, y); });
                     return list;
+
                 case SortFilesBy.FileSize:
                     items = items.OrderBy(f => new FileInfo(f).Length);
                     break;
+
                 case SortFilesBy.Extension:
                     items = items.OrderBy(f => new FileInfo(f).Extension);
                     break;
+
                 case SortFilesBy.Creationtime:
                     items = items.OrderBy(f => new FileInfo(f).CreationTime);
                     break;
+
                 case SortFilesBy.Lastaccesstime:
                     items = items.OrderBy(f => new FileInfo(f).LastAccessTime);
                     break;
+
                 case SortFilesBy.Lastwritetime:
                     items = items.OrderBy(f => new FileInfo(f).LastWriteTime);
                     break;
+
                 case SortFilesBy.Random:
                     items = items.OrderBy(f => Guid.NewGuid());
                     break;
@@ -209,8 +222,7 @@ namespace PicView.FileHandling
 #if DEBUG
                 Trace.WriteLine("Getvalues completed ");
 #endif
-
             }).ConfigureAwait(false);
         }
     }
-}
+}

+ 6 - 7
PicView/FileHandling/Open_Save.cs

@@ -1,14 +1,14 @@
 using Microsoft.Win32;
+using PicView.ImageHandling;
 using System;
 using System.Diagnostics;
 using System.IO;
+using System.Windows.Media.Imaging;
 using static PicView.ChangeImage.Error_Handling;
-using static PicView.Library.Fields;
 using static PicView.ChangeImage.Navigation;
-using static PicView.UI.UserControls.UC;
+using static PicView.Library.Fields;
 using static PicView.UI.Tooltip;
-using System.Windows.Media.Imaging;
-using PicView.ImageHandling;
+using static PicView.UI.UserControls.UC;
 
 namespace PicView.FileHandling
 {
@@ -69,7 +69,7 @@ namespace PicView.FileHandling
         /// <param name="file">The absolute path to the file</param>
         internal static void OpenWith(string file)
         {
-            using (var process = new Process())                      
+            using (var process = new Process())
             {
                 process.StartInfo.FileName = "openwith";
                 process.StartInfo.Arguments = $"\"{file}\"";
@@ -86,7 +86,6 @@ namespace PicView.FileHandling
 #endif
                     ShowTooltipMessage(e.Message, true);
                 }
-                
             }
         }
 
@@ -143,4 +142,4 @@ namespace PicView.FileHandling
             IsDialogOpen = false;
         }
     }
-}
+}

+ 2 - 7
PicView/FileHandling/RecentFiles.cs

@@ -1,7 +1,6 @@
 using PicView.Library;
 using System;
 using System.Collections.Generic;
-using System.Configuration;
 using System.IO;
 using System.Windows;
 using System.Windows.Controls;
@@ -17,7 +16,6 @@ namespace PicView.FileHandling
     /// </summary>
     internal static class RecentFiles
     {
-
         /// <summary>
         /// File list for Most Recently Used files
         /// </summary>
@@ -26,7 +24,7 @@ namespace PicView.FileHandling
         /// <summary>
         /// How many max recent files
         /// </summary>
-        const int MRUcount = 10;
+        private const int MRUcount = 10;
 
         internal static bool IsZipped { get; set; }
 
@@ -58,7 +56,6 @@ namespace PicView.FileHandling
             catch (Exception) { }
         }
 
-
         /// <summary>
         /// Function to add file to MRU
         /// </summary>
@@ -125,7 +122,6 @@ namespace PicView.FileHandling
             IsZipped = isZipped;
         }
 
-
         /// <summary>
         /// Adds events and submenu items to recent items in the context menu
         /// </summary>
@@ -205,6 +201,5 @@ namespace PicView.FileHandling
                 RecentFilesMenuItem.Items.Add(menuItem);
             }
         }
-
     }
-}
+}

+ 9 - 11
PicView/FileHandling/SupportedFiles.cs

@@ -69,24 +69,23 @@ namespace PicView.FileHandling
                 case ".srf":
                 case ".x3f":
 
-
                 // Obscure
-                
+
                 case ".bpg": // untested
-                case ".cur": 
+                case ".cur":
                 case ".cut": // untested
                 case ".dib": // untested
                 case ".emf": // untested
                 case ".exif": // untested
-                case ".exr": 
-                case ".hdr": 
-                case ".heic": 
+                case ".exr":
+                case ".hdr":
+                case ".heic":
                 case ".pcx":
                 case ".tga":
                 case ".wmf": // untested
-                case ".wpg": 
-                case ".xbm": 
-                case ".xpm": 
+                case ".wpg":
+                case ".xbm":
+                case ".xpm":
 
                     return false;
 
@@ -163,7 +162,6 @@ namespace PicView.FileHandling
                 case ".srf":
                 case ".x3f":
 
-
                 // Obscure
 
                 case ".bpg": // untested
@@ -204,4 +202,4 @@ namespace PicView.FileHandling
             }
         }
     }
-}
+}

+ 3 - 4
PicView/GlobalSuppressions.cs

@@ -1,7 +1,6 @@
-
-// This file is used by Code Analysis to maintain SuppressMessage 
+// This file is used by Code Analysis to maintain SuppressMessage
 // attributes that are applied to this project.
-// Project-level suppressions either have no target or are given 
+// Project-level suppressions either have no target or are given
 // a specific target and scoped to a namespace, type, member, etc.
 
 using System.Diagnostics.CodeAnalysis;
@@ -16,4 +15,4 @@ using System.Diagnostics.CodeAnalysis;
 [assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "<Pending>", Scope = "member", Target = "~M:PicView.ImageDecoder.TrySaveImage(System.Int32,System.Boolean,System.String,System.String)~System.Boolean")]
 [assembly: SuppressMessage("Style", "IDE0060:Remove unused parameter", Justification = "<Pending>", Scope = "member", Target = "~M:PicView.NativeMethods.WndProc(System.IntPtr,System.Int32,System.IntPtr,System.IntPtr,System.Boolean@)~System.IntPtr")]
 [assembly: SuppressMessage("Design", "CA1031:Do not catch general exception types", Justification = "<Pending>", Scope = "member", Target = "~M:PicView.Utilities.UpdateColor(System.Boolean)")]
-[assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "<Pending>", Scope = "member", Target = "~M:PicView.FileFunctions.MakeValidFileName(System.String)~System.String")]
+[assembly: SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "<Pending>", Scope = "member", Target = "~M:PicView.FileFunctions.MakeValidFileName(System.String)~System.String")]

+ 1 - 1
PicView/ImageHandling/Base64.cs

@@ -72,4 +72,4 @@ namespace PicView.ImageHandling
             }
         }
     }
-}
+}

+ 10 - 8
PicView/ImageHandling/Thumbnails.cs

@@ -1,12 +1,11 @@
 using ImageMagick;
-using PicView.ChangeImage;
-using static PicView.UI.UserControls.UC;
+using PicView.FileHandling;
+using PicView.UI.UserControls;
 using System.Diagnostics;
 using System.IO;
 using System.Windows.Media.Imaging;
 using static PicView.Library.Fields;
-using PicView.UI.UserControls;
-using PicView.FileHandling;
+using static PicView.UI.UserControls.UC;
 
 namespace PicView.ImageHandling
 {
@@ -47,9 +46,9 @@ namespace PicView.ImageHandling
         /// <returns></returns>
         internal static BitmapSource GetThumb(int x)
         {
-            var pic = Preloader.Load(Pics[x]);
+            BitmapSource pic;
 
-            if (pic == null)
+            if (picGallery.Container.Children.Count > 0)
             {
                 if (x < picGallery.Container.Children.Count && picGallery.Container.Children.Count == Pics.Count)
                 {
@@ -61,6 +60,10 @@ namespace PicView.ImageHandling
                     pic = GetBitmapSourceThumb(Pics[x]);
                 }
             }
+            else
+            {
+                pic = GetBitmapSourceThumb(Pics[x]);
+            }
 
             if (pic == null)
             {
@@ -119,7 +122,6 @@ namespace PicView.ImageHandling
 #if DEBUG
                 catch (MagickException e)
                 {
-
                     Trace.WriteLine("GetMagickImage returned " + file + " null, \n" + e.Message);
                     return null;
                 }
@@ -152,4 +154,4 @@ namespace PicView.ImageHandling
             return Microsoft.WindowsAPICodePack.Shell.ShellFile.FromFilePath(path).Thumbnail.BitmapSource;
         }
     }
-}
+}

+ 4 - 14
PicView/Library/Fields.cs

@@ -1,4 +1,5 @@
-using System.Collections.Generic;
+using PicView.SystemIntegration;
+using System.Collections.Generic;
 using System.Timers;
 using System.Windows;
 using System.Windows.Controls;
@@ -26,7 +27,6 @@ namespace PicView.Library
         + " *.png24 *.png32 *.png48 *.png64 *.png8 *.pnm *.ppm *.ps *.radialgradient *.ras *.rgb *.rgba *.rgbo *.rla *.rle *.scr *.screenshot *.sgi *.srf *.sun"
         + " *.svgz *.tiff64 *.ttf *.vda *.vicar *.vid *.viff *.vst *.vmf *.wpg *.xbm *.xcf *.yuv";
 
-
         /// <summary>
         ///  Files filterering string used for file/save dialog
         ///  TODO update for and check file support
@@ -141,6 +141,7 @@ namespace PicView.Library
         /// Starting point of AutoScroll
         /// </summary>
         internal static Point? autoScrollOrigin;
+
         /// <summary>
         /// Current point of AutoScroll
         /// </summary>
@@ -154,7 +155,6 @@ namespace PicView.Library
         /// </summary>
         internal static List<string> Pics { get; set; }
 
-
         //internal static List<ImageSource> Images { get; set; }
         /// <summary>
         /// Timer used to continously scroll with AutoScroll
@@ -195,15 +195,5 @@ namespace PicView.Library
         /// Primary ContextMenu
         /// </summary>
         internal static ContextMenu cm;
-
-        /// <summary>
-        /// Helper for user color settings
-        /// </summary>
-        internal static Color backgroundBorderColor;
-        /// <summary>
-        /// Helper for user color settings
-        /// </summary>
-        internal static Color mainColor;
-
     }
-}
+}

+ 3 - 3
PicView/Library/Resources/DrawingBrushes.cs

@@ -9,7 +9,7 @@ namespace PicView.Library.Resources
 
         public static DrawingBrush CheckerboardDrawingBrush(Color color)
         {
-            return CheckerboardDrawingBrush(color, Fields.backgroundBorderColor, 30);
+            return CheckerboardDrawingBrush(color, UI.ConfigColors.backgroundBorderColor, 30);
         }
 
         public static DrawingBrush CheckerboardDrawingBrush(Color color, Color color2, int size)
@@ -57,6 +57,6 @@ namespace PicView.Library.Resources
             return draw;
         }
 
-        #endregion
+        #endregion DrawingBrush
     }
-}
+}

+ 4 - 9
PicView/Library/Resources/SvgIcons.cs

@@ -1,17 +1,17 @@
-
-
-namespace PicView.Library.Resources
+namespace PicView.Library.Resources
 {
     internal static class SvgIcons
     {
         // https://ionicons.com/
         internal const string SVGiconCamera = "M448 405.333V106.667C448 83.198 428.802 64 405.333 64H106.667C83.198 64 64 83.198 64 106.667v298.666C64 428.802 83.198 448 106.667 448h298.666C428.802 448 448 428.802 448 405.333zM181.333 288l53.334 64 74.666-96 96 128H106.667l74.666-96z";
+
         internal const string SVGiconCopy = "M1696 384q40 0 68 28t28 68v1216q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-288h-544q-40 0-68-28t-28-68v-672q0-40 20-88t48-76l408-408q28-28 76-48t88-20h416q40 0 68 28t28 68v328q68-40 128-40h416zm-544 213l-299 299h299v-299zm-640-384l-299 299h299v-299zm196 647l316-316v-416h-384v416q0 40-28 68t-68 28h-416v640h512v-256q0-40 20-88t48-76zm956 804v-1152h-384v416q0 40-28 68t-68 28h-416v640h896z";
         //internal const string InfiniteIconSVG = "M434.7 188c-18.8-18-43.8-28-70.5-28-26.6 0-51.6 9.9-70.4 27.9l-17.6 15.9 33.1 32.1 17-15.4.1-.1c10.1-9.6 23.5-15 37.7-15 14.2 0 27.6 5.3 37.7 14.9 10 9.6 15.4 22.3 15.4 35.8 0 13.5-5.5 26.1-15.4 35.6-10.1 9.6-23.5 15-37.7 15s-27.6-5.3-37.7-14.9L218.2 188c-18.9-18-43.9-28-70.4-28-26.7 0-51.7 9.9-70.5 28C58.4 206.1 48 230.2 48 256c0 25.7 10.4 49.9 29.3 68 18.8 18 43.8 28 70.5 28 26.7 0 51.7-9.9 70.4-28l37.8-36.1 37.7 36.1c18.9 18 43.9 28 70.4 28 26.7 0 51.7-9.9 70.4-27.9 19-18.1 29.4-42.2 29.4-68 .1-25.8-10.3-50-29.2-68.1zM185.5 291.7c-10.1 9.6-23.5 15-37.7 15-14.2 0-27.6-5.3-37.7-14.9-10-9.6-15.4-22.3-15.4-35.8 0-13.5 5.5-26.1 15.4-35.6 10.1-9.6 23.5-15 37.7-15 14.2 0 27.6 5.3 37.7 14.9l37.4 35.8-37.4 35.6z";
         //internal const string SVGiconGithub = "M256,32C132.3,32,32,134.9,32,261.7c0,101.5,64.2,187.5,153.2,217.9a17.56,17.56,0,0,0,3.8.4c8.3,0,11.5-6.1,11.5-11.4,0-5.5-.2-19.9-.3-39.1a102.4,102.4,0,0,1-22.6,2.7c-43.1,0-52.9-33.5-52.9-33.5-10.2-26.5-24.9-33.6-24.9-33.6-19.5-13.7-.1-14.1,1.4-14.1h.1c22.5,2,34.3,23.8,34.3,23.8,11.2,19.6,26.2,25.1,39.6,25.1a63,63,0,0,0,25.6-6c2-14.8,7.8-24.9,14.2-30.7-49.7-5.8-102-25.5-102-113.5,0-25.1,8.7-45.6,23-61.6-2.3-5.8-10-29.2,2.2-60.8a18.64,18.64,0,0,1,5-.5c8.1,0,26.4,3.1,56.6,24.1a208.21,208.21,0,0,1,112.2,0c30.2-21,48.5-24.1,56.6-24.1a18.64,18.64,0,0,1,5,.5c12.2,31.6,4.5,55,2.2,60.8,14.3,16.1,23,36.6,23,61.6,0,88.2-52.4,107.6-102.3,113.3,8,7.1,15.2,21.1,15.2,42.5,0,30.7-.3,55.5-.3,63,0,5.4,3.1,11.5,11.4,11.5a19.35,19.35,0,0,0,4-.4C415.9,449.2,480,363.1,480,261.7,480,134.9,379.7,32,256,32Z";
 
         // http://www.zondicons.com/
         internal const string SVGiconScissor = "M9.77 11.5l5.34 3.91c.44.33 1.24.59 1.79.59H20L6.89 6.38A3.5 3.5 0 1 0 5.5 8.37L7.73 10 5.5 11.63a3.5 3.5 0 1 0 1.38 1.99l2.9-2.12zM3.5 7a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zm0 9a1.5 1.5 0 1 1 0-3 1.5 1.5 0 0 1 0 3zM15.1 4.59A3.53 3.53 0 0 1 16.9 4H20l-7.5 5.5L10.45 8l4.65-3.41z";
+
         internal const string SVGiconSend = "M0 0l20 10L0 20V0zm0 8v4l10-2L0 8z";
 
         internal const string SVGiconFile = "M1717 931q0-35-53-35h-1088q-40 0-85.5 21.5t-71.5 52.5l-294 363q-18 24-18 40 0 35 53 35h1088q40 0 86-22t71-53l294-363q18-22 18-39zm-1141-163h768v-160q0-40-28-68t-68-28h-576q-40 0-68-28t-28-68v-64q0-40-28-68t-68-28h-320q-40 0-68 28t-28 68v853l256-315q44-53 116-87.5t140-34.5zm1269 163q0 62-46 120l-295 363q-43 53-116 87.5t-140 34.5h-1088q-92 0-158-66t-66-158v-960q0-92 66-158t158-66h320q92 0 158 66t66 158v32h544q92 0 158 66t66 158v160h192q54 0 99 24.5t67 70.5q15 32 15 68z";
@@ -25,10 +25,5 @@ namespace PicView.Library.Resources
         internal const string SVGiconPaste = "M768 1664h896v-640h-416q-40 0-68-28t-28-68v-416h-384v1152zm256-1440v-64q0-13-9.5-22.5t-22.5-9.5h-704q-13 0-22.5 9.5t-9.5 22.5v64q0 13 9.5 22.5t22.5 9.5h704q13 0 22.5-9.5t9.5-22.5zm256 672h299l-299-299v299zm512 128v672q0 40-28 68t-68 28h-960q-40 0-68-28t-28-68v-160h-544q-40 0-68-28t-28-68v-1344q0-40 28-68t68-28h1088q40 0 68 28t28 68v328q21 13 36 28l408 408q28 28 48 76t20 88z";
         internal const string SVGiconRecycle = "M836 1169l-15 368-2 22-420-29q-36-3-67-31.5t-47-65.5q-11-27-14.5-55t4-65 12-55 21.5-64 19-53q78 12 509 28zm-387-586l180 379-147-92q-63 72-111.5 144.5t-72.5 125-39.5 94.5-18.5 63l-4 21-190-357q-17-26-18-56t6-47l8-18q35-63 114-188l-140-86zm1231 517l-188 359q-12 29-36.5 46.5t-43.5 20.5l-18 4q-71 7-219 12l8 164-230-367 211-362 7 173q170 16 283 5t170-33zm-785-924q-47 63-265 435l-317-187-19-12 225-356q20-31 60-45t80-10q24 2 48.5 12t42 21 41.5 33 36 34.5 36 39.5 32 35zm655 307l212 363q18 37 12.5 76t-27.5 74q-13 20-33 37t-38 28-48.5 22-47 16-51.5 14-46 12q-34-72-265-436l313-195zm-143-226l142-83-220 373-419-20 151-86q-34-89-75-166t-75.5-123.5-64.5-80-47-46.5l-17-13 405 1q31-3 58 10.5t39 28.5l11 15q39 61 112 190z";
         internal const string SVGiconClose = "M443.6,387.1L312.4,255.4l131.5-130c5.4-5.4,5.4-14.2,0-19.6l-37.4-37.6c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4  L256,197.8L124.9,68.3c-2.6-2.6-6.1-4-9.8-4c-3.7,0-7.2,1.5-9.8,4L68,105.9c-5.4,5.4-5.4,14.2,0,19.6l131.5,130L68.4,387.1  c-2.6,2.6-4.1,6.1-4.1,9.8c0,3.7,1.4,7.2,4.1,9.8l37.4,37.6c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1L256,313.1l130.7,131.1  c2.7,2.7,6.2,4.1,9.8,4.1c3.5,0,7.1-1.3,9.8-4.1l37.4-37.6c2.6-2.6,4.1-6.1,4.1-9.8C447.7,393.2,446.2,389.7,443.6,387.1z";
-
-
-
-
-
     }
-}
+}

+ 3 - 3
PicView/Library/Resources/Timers.cs

@@ -1,6 +1,6 @@
 using System.Timers;
-using static PicView.UI.Animations.FadeControls;
 using static PicView.Library.Fields;
+using static PicView.UI.Animations.FadeControls;
 using static PicView.UI.TransformImage.Scroll;
 
 namespace PicView.Library.Resources
@@ -50,6 +50,6 @@ namespace PicView.Library.Resources
             //MouseIdleTimer.Elapsed += delegate { HideCursorTimer.Start(); };
         }
 
-        #endregion
+        #endregion Add Timers
     }
-}
+}

+ 3 - 36
PicView/Library/Utilities.cs

@@ -1,13 +1,8 @@
-using Microsoft.WindowsAPICodePack.Taskbar;
-using PicView.Library.Resources;
-using System.Configuration;
+using System.Configuration;
 using System.Diagnostics;
 using System.IO;
 using System.Windows;
 using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Media.Imaging;
-using static PicView.Library.Fields;
 
 namespace PicView.Library
 {
@@ -26,7 +21,6 @@ namespace PicView.Library
             return y == 0 ? x : GCD(y, x % y);
         }
 
-
         /// <summary>
         /// Gets the absolute mouse position, relative to screen
         /// </summary>
@@ -36,33 +30,7 @@ namespace PicView.Library
             return element.PointToScreen(Mouse.GetPosition(element));
         }
 
-
-        #endregion
-
-        #region Progress
-
-        /// <summary>
-        /// Show progress on taskbar
-        /// </summary>
-        /// <param name="i">index</param>
-        /// <param name="ii">size</param>
-        internal static void Progress(int i, int ii)
-        {
-            TaskbarManager prog = TaskbarManager.Instance;
-            prog.SetProgressState(TaskbarProgressBarState.Normal);
-            prog.SetProgressValue(i, ii);
-        }
-
-        /// <summary>
-        /// Stop showing taskbar progress, return to default
-        /// </summary>
-        internal static void NoProgress()
-        {
-            TaskbarManager prog = TaskbarManager.Instance;
-            prog.SetProgressState(TaskbarProgressBarState.NoProgress);
-        }
-
-        #endregion
+        #endregion static helpers
 
         /// <summary>
         /// Sends the file to Windows print system
@@ -124,6 +92,5 @@ namespace PicView.Library
         {
             return Path.GetDirectoryName(GetDefaultExeConfigPath(ConfigurationUserLevel.PerUserRoamingAndLocal));
         }
-
     }
-}
+}

+ 1 - 1
PicView/PicView.csproj

@@ -51,7 +51,7 @@
   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
     <PlatformTarget>x64</PlatformTarget>
     <DebugType>none</DebugType>
-    <Optimize>false</Optimize>
+    <Optimize>true</Optimize>
     <OutputPath>bin\Release\</OutputPath>
     <DefineConstants>
     </DefineConstants>

+ 9 - 12
PicView/Properties/AssemblyInfo.cs

@@ -2,7 +2,7 @@ using System.Resources;
 using System.Runtime.InteropServices;
 using System.Windows;
 
-// General Information about an assembly is controlled through the following 
+// General Information about an assembly is controlled through the following
 // set of attributes. Change these attribute values to modify the information
 // associated with an assembly.
 //[assembly: AssemblyTitle("PicView")]
@@ -14,12 +14,12 @@ using System.Windows;
 //[assembly: AssemblyTrademark("")]
 //[assembly: AssemblyCulture("")]
 
-// Setting ComVisible to false makes the types in this assembly not visible 
-// to COM components.  If you need to access a type in this assembly from 
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components.  If you need to access a type in this assembly from
 // COM, set the ComVisible attribute to true on that type.
 [assembly: ComVisible(false)]
 
-//In order to begin building localizable applications, set 
+//In order to begin building localizable applications, set
 //<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
 //inside a <PropertyGroup>.  For example, if you are using US english
 //in your source files, set the <UICulture> to en-US.  Then uncomment
@@ -28,28 +28,25 @@ using System.Windows;
 
 //[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
 
-
 [assembly: ThemeInfo(
     ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
-                                     //(used if a resource is not found in the page, 
+                                     //(used if a resource is not found in the page,
                                      // or application resource dictionaries)
     ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
-                                              //(used if a resource is not found in the page, 
+                                              //(used if a resource is not found in the page,
                                               // app, or any theme specific resource dictionaries)
 )]
 
-
 // Version information for an assembly consists of the following four values:
 //
 //      Major Version
-//      Minor Version 
+//      Minor Version
 //      Build Number
 //      Revision
 //
-// You can specify all the values or you can default the Build and Revision Numbers 
+// You can specify all the values or you can default the Build and Revision Numbers
 // by using the '*' as shown below:
 // [assembly: AssemblyVersion("1.0.*")]
 //[assembly: AssemblyVersion("1.0.0.0")]
 //[assembly: AssemblyFileVersion("0.9.7.0")]
-[assembly: NeutralResourcesLanguage("en")]
-
+[assembly: NeutralResourcesLanguage("en")]

+ 2 - 3
PicView/Shortcuts/CustomTextBoxShortcuts.cs

@@ -20,6 +20,5 @@ namespace PicView
                     break;
             }
         }
-    } 
-}
-
+    }
+}

+ 6 - 6
PicView/Shortcuts/GotoPicsShortcuts.cs

@@ -1,14 +1,13 @@
 using System.Globalization;
 using System.Windows.Input;
-using static PicView.Library.Fields;
 using static PicView.ChangeImage.GoToLogic;
+using static PicView.Library.Fields;
 using static PicView.UI.UserControls.UC;
 
 namespace PicView
 {
     internal static class GotoPicsShortcuts
     {
-
         internal static void GoToPicPreviewKeys(object sender, KeyEventArgs e)
         {
             switch (e.Key)
@@ -53,15 +52,16 @@ namespace PicView
                     quickSettingsMenu.GoToPicBox.Text = FolderIndex.ToString(CultureInfo.CurrentCulture);
                     ClearGoTo();
                     break;
+
                 case Key.Enter: // Execute it!
                     GoToPicEvent(sender, e);
                     ClearGoTo();
                     break;
-                default: 
+
+                default:
                     e.Handled = true; // Don't allow other keys
                     break;
             }
         }
-    } 
-}
-
+    }
+}

+ 11 - 11
PicView/Shortcuts/MainShortcuts.cs

@@ -63,14 +63,14 @@ namespace PicView.Shortcuts
                         {
                             SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, FolderIndex);
                         }
-                        
+
                         ImageCropping.SaveCrop();
                         mainWindow.bg.Children.Remove(cropppingTool);
                     }
                 }
             }
 
-            #endregion
+            #endregion CroppingKeys
 
             #region Keys where it can be held down
 
@@ -192,7 +192,7 @@ namespace PicView.Shortcuts
                                 ScrollTo(false, (Keyboard.Modifiers & ModifierKeys.Control) == ModifierKeys.Control);
                                 return;
                             }
-                            if (ctrlDown) 
+                            if (ctrlDown)
                             {
                                 Rotate(false);
                             }
@@ -256,12 +256,12 @@ namespace PicView.Shortcuts
                 // Zoom
                 case Key.Add:
                 case Key.OemPlus:
-                        Zoom(1, ctrlDown);
+                    Zoom(1, ctrlDown);
                     return;
 
                 case Key.Subtract:
                 case Key.OemMinus:
-                        Zoom(-1, ctrlDown);
+                    Zoom(-1, ctrlDown);
                     return;
             }
 
@@ -406,7 +406,7 @@ namespace PicView.Shortcuts
                     case Key.I:
                         if (ctrlDown)
                         {
-                            NativeMethods.ShowFileProperties(Pics[FolderIndex]);
+                            SystemIntegration.NativeMethods.ShowFileProperties(Pics[FolderIndex]);
                         }
 
                         break;
@@ -535,7 +535,7 @@ namespace PicView.Shortcuts
                 }
             }
 
-#endregion Key is not held down
+            #endregion Key is not held down
 
             #region Alt + keys
 
@@ -560,7 +560,7 @@ namespace PicView.Shortcuts
                 //e.Handled = true;
             }
 
-#endregion Alt + keys
+            #endregion Alt + keys
         }
 
         internal static void MainWindow_KeysUp(object sender, KeyEventArgs e)
@@ -571,12 +571,14 @@ namespace PicView.Shortcuts
             switch (e.Key)
             {
                 #region FastPicUpdate()
+
                 case Key.A:
                 case Key.Right:
                 case Key.D:
                     FastPicUpdate();
                     break;
-#endregion
+
+                    #endregion FastPicUpdate()
             }
         }
 
@@ -613,7 +615,5 @@ namespace PicView.Shortcuts
                     break;
             }
         }
-
-
     }
 }

+ 5 - 7
PicView/Os_Integration/MonitorSize.cs → PicView/SystemIntegration/MonitorSize.cs

@@ -1,10 +1,10 @@
 using System;
 using System.Windows;
 
-namespace PicView
+namespace PicView.SystemIntegration
 {
     /// <summary>
-    /// Logic for the current monitor's screen resolution 
+    /// Logic for the current monitor's screen resolution
     /// </summary>
     internal readonly struct MonitorSize
     {
@@ -37,7 +37,7 @@ namespace PicView
         internal static MonitorSize GetMonitorSize()
         {
             /// TODO Get Solution to get actual screen pixel size
-            /// and not just without taskbar and such... 
+            /// and not just without taskbar and such...
             /// Needs to get updated when dragging to different screen
             /// Window.LocationChanged Event https://docs.microsoft.com/en-us/dotnet/api/system.windows.window.locationchanged?redirectedfrom=MSDN&view=netcore-3.1
             /// is not proper, since it also fires on Left and Top property changes
@@ -47,7 +47,7 @@ namespace PicView
 
             //find out if our app is being scaled by the monitor
             var source = PresentationSource.FromVisual(Application.Current.MainWindow);
-            var dpiScaling = (source != null && source.CompositionTarget != null ? source.CompositionTarget.TransformFromDevice.M11 : 1);
+            var dpiScaling = source != null && source.CompositionTarget != null ? source.CompositionTarget.TransformFromDevice.M11 : 1;
 
             //get the available area of the monitor
             var workArea = currentMonitor.WorkingArea;
@@ -56,8 +56,6 @@ namespace PicView
 
             //return new MonitorSize(workAreaWidth, workAreaHeight, dpiScaling, workArea);
             return new MonitorSize(workAreaWidth, workAreaHeight, dpiScaling, workArea);
-
         }
     }
-
-}
+}

+ 16 - 13
PicView/Os_Integration/NativeMethods.cs → PicView/SystemIntegration/NativeMethods.cs

@@ -3,7 +3,7 @@ using System;
 using System.Runtime.InteropServices;
 using System.Security;
 
-namespace PicView
+namespace PicView.SystemIntegration
 {
     //https://msdn.microsoft.com/en-us/library/ms182161.aspx
     [SuppressUnmanagedCodeSecurity]
@@ -50,19 +50,26 @@ namespace PicView
             public int cbSize;
             public uint fMask;
             public IntPtr hwnd;
+
             [MarshalAs(UnmanagedType.LPTStr)]
             public string lpVerb;
+
             [MarshalAs(UnmanagedType.LPTStr)]
             public string lpFile;
+
             [MarshalAs(UnmanagedType.LPTStr)]
             public string lpParameters;
+
             [MarshalAs(UnmanagedType.LPTStr)]
             public readonly string lpDirectory;
+
             public int nShow;
             public IntPtr hInstApp;
             public IntPtr lpIDList;
+
             [MarshalAs(UnmanagedType.LPTStr)]
             public readonly string lpClass;
+
             public IntPtr hkeyClass;
             public readonly uint dwHotKey;
             public IntPtr hIcon;
@@ -75,14 +82,16 @@ namespace PicView
         // Remove from Alt + tab
         [DllImport("user32.dll", SetLastError = true)]
         internal static extern int GetWindowLong(IntPtr hWnd, int nIndex);
+
         [DllImport("user32.dll")]
         internal static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
+
         internal const int GWL_EX_STYLE = -20;
         internal const int WS_EX_APPWINDOW = 0x00040000, WS_EX_TOOLWINDOW = 0x00000080;
 
-
         // Disable Screensaver and Power options.
         internal const uint ES_CONTINUOUS = 0x80000000;
+
         internal const uint ES_SYSTEM_REQUIRED = 0x00000001;
         internal const uint ES_DISPLAY_REQUIRED = 0x00000002;
 
@@ -90,19 +99,17 @@ namespace PicView
         public static extern uint SetThreadExecutionState([In] uint esFlags);
 
         // https://stackoverflow.com/a/60938929/13646636
-        const int WM_SIZING = 0x214;
-        const int WM_EXITSIZEMOVE = 0x232;
-        private static bool WindowWasResized = false;
+        private const int WM_SIZING = 0x214;
 
+        private const int WM_EXITSIZEMOVE = 0x232;
+        private static bool WindowWasResized = false;
 
         public static IntPtr WndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
         {
             if (msg == WM_SIZING)
             {
-
                 if (WindowWasResized == false)
                 {
-
                     //    'indicate the the user is resizing and not moving the window
                     WindowWasResized = true;
                 }
@@ -110,11 +117,9 @@ namespace PicView
 
             if (msg == WM_EXITSIZEMOVE)
             {
-
-                // 'check that this is the end of resize and not move operation          
+                // 'check that this is the end of resize and not move operation
                 if (WindowWasResized == true)
                 {
-
                     // your stuff to do
                     ScaleImage.TryFitImage();
 
@@ -125,7 +130,5 @@ namespace PicView
 
             return IntPtr.Zero;
         }
-
-
     }
-}
+}

+ 32 - 0
PicView/SystemIntegration/Taskbar.cs

@@ -0,0 +1,32 @@
+using Microsoft.WindowsAPICodePack.Taskbar;
+
+namespace PicView.SystemIntegration
+{
+    internal class Taskbar
+    {
+        #region Progress
+
+        /// <summary>
+        /// Show progress on taskbar
+        /// </summary>
+        /// <param name="i">index</param>
+        /// <param name="ii">size</param>
+        internal static void Progress(int i, int ii)
+        {
+            TaskbarManager prog = TaskbarManager.Instance;
+            prog.SetProgressState(TaskbarProgressBarState.Normal);
+            prog.SetProgressValue(i, ii);
+        }
+
+        /// <summary>
+        /// Stop showing taskbar progress, return to default
+        /// </summary>
+        internal static void NoProgress()
+        {
+            TaskbarManager prog = TaskbarManager.Instance;
+            prog.SetProgressState(TaskbarProgressBarState.NoProgress);
+        }
+
+        #endregion Progress
+    }
+}

+ 20 - 24
PicView/Os_Integration/Wallpaper.cs → PicView/SystemIntegration/Wallpaper.cs

@@ -9,7 +9,7 @@ using System.Threading.Tasks;
 using System.Timers;
 using static PicView.Library.Fields;
 
-namespace PicView
+namespace PicView.SystemIntegration
 {
     public static class Wallpaper // Taken from a Microsoft sample...
     {
@@ -73,10 +73,9 @@ namespace PicView
             }
         }
 
-
         /// <summary>
-        /// Determine if .jpg files are supported as wallpaper in the current 
-        /// operating system. The .jpg wallpapers are not supported before 
+        /// Determine if .jpg files are supported as wallpaper in the current
+        /// operating system. The .jpg wallpapers are not supported before
         /// Windows Vista.
         /// </summary>
         public static bool SupportJpgAsWallpaper
@@ -87,10 +86,9 @@ namespace PicView
             }
         }
 
-
         /// <summary>
-        /// Determine if the fit and fill wallpaper styles are supported in 
-        /// the current operating system. The styles are not supported before 
+        /// Determine if the fit and fill wallpaper styles are supported in
+        /// the current operating system. The styles are not supported before
         /// Windows 7.
         /// </summary>
         public static bool SupportFitFillWallpaperStyles
@@ -101,7 +99,6 @@ namespace PicView
             }
         }
 
-
         /// <summary>
         /// Set the desktop wallpaper.
         /// </summary>
@@ -109,17 +106,17 @@ namespace PicView
         /// <param name="style">Wallpaper style</param>
         public static void SetDesktopWallpaper(string path, WallpaperStyle style)
         {
-            // Set the wallpaper style and tile. 
+            // Set the wallpaper style and tile.
             // Two registry values are set in the Control Panel\Desktop key.
             // TileWallpaper
-            //  0: The wallpaper picture should not be tiled 
-            //  1: The wallpaper picture should be tiled 
+            //  0: The wallpaper picture should not be tiled
+            //  1: The wallpaper picture should be tiled
             // WallpaperStyle
             //  0:  The image is centered if TileWallpaper=0 or tiled if TileWallpaper=1
             //  2:  The image is stretched to fill the screen
-            //  6:  The image is resized to fit the screen while maintaining the aspect 
+            //  6:  The image is resized to fit the screen while maintaining the aspect
             //      ratio. (Windows 7 and later)
-            //  10: The image is resized and cropped to fill the screen while 
+            //  10: The image is resized and cropped to fill the screen while
             //      maintaining the aspect ratio. (Windows 7 and later)
             RegistryKey key = Registry.CurrentUser.OpenSubKey(@"Control Panel\Desktop", true);
 
@@ -129,18 +126,22 @@ namespace PicView
                     key.SetValue(@"WallpaperStyle", "0");
                     key.SetValue(@"TileWallpaper", "1");
                     break;
+
                 case WallpaperStyle.Center:
                     key.SetValue(@"WallpaperStyle", "0");
                     key.SetValue(@"TileWallpaper", "0");
                     break;
+
                 case WallpaperStyle.Stretch:
                     key.SetValue(@"WallpaperStyle", "2");
                     key.SetValue(@"TileWallpaper", "0");
                     break;
+
                 case WallpaperStyle.Fit: // (Windows 7 and later)
                     key.SetValue(@"WallpaperStyle", "6");
                     key.SetValue(@"TileWallpaper", "0");
                     break;
+
                 case WallpaperStyle.Fill: // (Windows 7 and later)
                     key.SetValue(@"WallpaperStyle", "10");
                     key.SetValue(@"TileWallpaper", "0");
@@ -153,9 +154,9 @@ namespace PicView
             /// works for Windows supported standard images, such as PSD to jpg?
 
             // If the specified image file is neither .bmp nor .jpg, - or -
-            // if the image is a .jpg file but the operating system is Windows Server 
-            // 2003 or Windows XP/2000 that does not support .jpg as the desktop 
-            // wallpaper, convert the image file to .bmp and save it to the 
+            // if the image is a .jpg file but the operating system is Windows Server
+            // 2003 or Windows XP/2000 that does not support .jpg as the desktop
+            // wallpaper, convert the image file to .bmp and save it to the
             // %appdata%\Microsoft\Windows\Themes folder.
             string ext = Path.GetExtension(path);
             if ((!ext.Equals(".bmp", StringComparison.OrdinalIgnoreCase) &&
@@ -169,11 +170,10 @@ namespace PicView
                         Path.GetFileNameWithoutExtension(path));
                 SaveImages.TrySaveImage(Rotateint, Flipped, path, dest);
                 path = dest;
-
             }
 
-            // Set the desktop wallpapaer by calling the Win32 API SystemParametersInfo 
-            // with the SPI_SETDESKWALLPAPER desktop parameter. The changes should 
+            // Set the desktop wallpapaer by calling the Win32 API SystemParametersInfo
+            // with the SPI_SETDESKWALLPAPER desktop parameter. The changes should
             // persist, and also be immediately visible.
             if (!NativeMethods.SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, path,
                 SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE))
@@ -182,12 +182,8 @@ namespace PicView
             }
         }
 
-
         private const uint SPI_SETDESKWALLPAPER = 20;
         private const uint SPIF_UPDATEINIFILE = 0x01;
         private const uint SPIF_SENDWININICHANGE = 0x02;
     }
-
-
-
-}
+}

+ 89 - 13
PicView/UI/Animations/AnimationHelper.cs

@@ -1,5 +1,4 @@
-
-using PicView.Library;
+using PicView.Library;
 using PicView.UI.UserControls;
 using System;
 using System.Windows;
@@ -14,6 +13,7 @@ namespace PicView.UI.Animations
         private static readonly ColorAnimation ccAnim = new ColorAnimation { Duration = TimeSpan.FromSeconds(.35) };
 
         #region Fade
+
         internal static void Fade(UIElement element, double to, Duration duration)
         {
             var da = new DoubleAnimation()
@@ -35,7 +35,8 @@ namespace PicView.UI.Animations
             };
             element.BeginAnimation(UIElement.OpacityProperty, da);
         }
-        #endregion
+
+        #endregion Fade
 
         #region Color Events
 
@@ -76,36 +77,47 @@ namespace PicView.UI.Animations
                 default:
                     ccAnim.From = Properties.Settings.Default.Blue;
                     break;
+
                 case 2:
                     ccAnim.From = Properties.Settings.Default.Pink;
                     break;
+
                 case 3:
                     ccAnim.From = Properties.Settings.Default.Orange;
                     break;
+
                 case 4:
                     ccAnim.From = Properties.Settings.Default.Green;
                     break;
+
                 case 5:
                     ccAnim.From = Properties.Settings.Default.Red;
                     break;
+
                 case 6:
                     ccAnim.From = Properties.Settings.Default.Teal;
                     break;
+
                 case 7:
                     ccAnim.From = Properties.Settings.Default.Aqua;
                     break;
+
                 case 8:
                     ccAnim.From = Properties.Settings.Default.Beige;
                     break;
+
                 case 9:
                     ccAnim.From = Properties.Settings.Default.Purple;
                     break;
+
                 case 10:
                     ccAnim.From = Properties.Settings.Default.Cyan;
                     break;
+
                 case 11:
                     ccAnim.From = Properties.Settings.Default.Magenta;
                     break;
+
                 case 12:
                     ccAnim.From = Properties.Settings.Default.Grey;
                     break;
@@ -123,36 +135,47 @@ namespace PicView.UI.Animations
                 default:
                     ccAnim.To = Properties.Settings.Default.Blue;
                     break;
+
                 case 2:
                     ccAnim.To = Properties.Settings.Default.Pink;
                     break;
+
                 case 3:
                     ccAnim.To = Properties.Settings.Default.Orange;
                     break;
+
                 case 4:
                     ccAnim.To = Properties.Settings.Default.Green;
                     break;
+
                 case 5:
                     ccAnim.To = Properties.Settings.Default.Red;
                     break;
+
                 case 6:
                     ccAnim.To = Properties.Settings.Default.Teal;
                     break;
+
                 case 7:
                     ccAnim.To = Properties.Settings.Default.Aqua;
                     break;
+
                 case 8:
                     ccAnim.To = Properties.Settings.Default.Beige;
                     break;
+
                 case 9:
                     ccAnim.To = Properties.Settings.Default.Purple;
                     break;
+
                 case 10:
                     ccAnim.To = Properties.Settings.Default.Cyan;
                     break;
+
                 case 11:
                     ccAnim.To = Properties.Settings.Default.Magenta;
                     break;
+
                 case 12:
                     ccAnim.To = Properties.Settings.Default.Grey;
                     break;
@@ -169,46 +192,57 @@ namespace PicView.UI.Animations
                     ccAnim.From = Properties.Settings.Default.Blue;
                     ccAnim.To = Properties.Settings.Default.BlueAlpha;
                     break;
+
                 case 2:
                     ccAnim.From = Properties.Settings.Default.Pink;
                     ccAnim.To = Properties.Settings.Default.PinkAlpha;
                     break;
+
                 case 3:
                     ccAnim.From = Properties.Settings.Default.Orange;
                     ccAnim.To = Properties.Settings.Default.OrangeAlpha;
                     break;
+
                 case 4:
                     ccAnim.From = Properties.Settings.Default.Green;
                     ccAnim.To = Properties.Settings.Default.GreenAlpha;
                     break;
+
                 case 5:
                     ccAnim.From = Properties.Settings.Default.Red;
                     ccAnim.To = Properties.Settings.Default.RedAlpha;
                     break;
+
                 case 6:
                     ccAnim.From = Properties.Settings.Default.Teal;
                     ccAnim.To = Properties.Settings.Default.TealAlpha;
                     break;
+
                 case 7:
                     ccAnim.From = Properties.Settings.Default.Aqua;
                     ccAnim.To = Properties.Settings.Default.AquaAlpha;
                     break;
+
                 case 8:
                     ccAnim.From = Properties.Settings.Default.Beige;
                     ccAnim.To = Properties.Settings.Default.BeigeAlpha;
                     break;
+
                 case 9:
                     ccAnim.From = Properties.Settings.Default.Purple;
                     ccAnim.To = Properties.Settings.Default.PurpleAlpha;
                     break;
+
                 case 10:
                     ccAnim.From = Properties.Settings.Default.Cyan;
                     ccAnim.To = Properties.Settings.Default.CyanAlpha;
                     break;
+
                 case 11:
                     ccAnim.From = Properties.Settings.Default.Magenta;
                     ccAnim.To = Properties.Settings.Default.MagentaAlpha;
                     break;
+
                 case 12:
                     ccAnim.From = Properties.Settings.Default.Grey;
                     ccAnim.To = Properties.Settings.Default.GreyAlpha;
@@ -220,13 +254,13 @@ namespace PicView.UI.Animations
         internal static void MouseEnterBgColor(Brush brush)
         {
             ccAnim.From = Color.FromArgb(0, 0, 0, 0);
-            ccAnim.To = Fields.backgroundBorderColor;
+            ccAnim.To = UI.ConfigColors.backgroundBorderColor;
             brush.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
         }
 
         internal static void MouseLeaveBgColor(Brush brush)
         {
-            ccAnim.From = Fields.backgroundBorderColor;
+            ccAnim.From = UI.ConfigColors.backgroundBorderColor;
             ccAnim.To = Color.FromArgb(0, 0, 0, 0);
             brush.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
         }
@@ -245,7 +279,7 @@ namespace PicView.UI.Animations
             brush.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
         }
 
-        #endregion
+        #endregion Color Events
 
         #region Color stuff
 
@@ -258,29 +292,39 @@ namespace PicView.UI.Animations
                 case 1:
                 default:
                     return Properties.Settings.Default.Blue;
+
                 case 2:
                     return Properties.Settings.Default.Pink;
+
                 case 3:
                     return Properties.Settings.Default.Orange;
+
                 case 4:
                     return Properties.Settings.Default.Green;
+
                 case 5:
                     return Properties.Settings.Default.Red;
+
                 case 6:
                     return Properties.Settings.Default.Teal;
+
                 case 7:
                     return Properties.Settings.Default.Aqua;
+
                 case 8:
                     return Properties.Settings.Default.Beige;
+
                 case 9:
                     return Properties.Settings.Default.Purple;
+
                 case 10:
                     return Properties.Settings.Default.Cyan;
+
                 case 11:
                     return Properties.Settings.Default.Magenta;
+
                 case 12:
                     return Properties.Settings.Default.Grey;
-
             }
         }
 
@@ -291,26 +335,37 @@ namespace PicView.UI.Animations
                 case 1:
                 default:
                     return Properties.Settings.Default.BlueAlpha;
+
                 case 2:
                     return Properties.Settings.Default.PinkAlpha;
+
                 case 3:
                     return Properties.Settings.Default.OrangeAlpha;
+
                 case 4:
                     return Properties.Settings.Default.GreenAlpha;
+
                 case 5:
                     return Properties.Settings.Default.RedAlpha;
+
                 case 6:
                     return Properties.Settings.Default.TealAlpha;
+
                 case 7:
                     return Properties.Settings.Default.AquaAlpha;
+
                 case 8:
                     return Properties.Settings.Default.BeigeAlpha;
+
                 case 9:
                     return Properties.Settings.Default.PurpleAlpha;
+
                 case 10:
                     return Properties.Settings.Default.CyanAlpha;
+
                 case 11:
                     return Properties.Settings.Default.MagentaAlpha;
+
                 case 12:
                     return Properties.Settings.Default.GreyAlpha;
             }
@@ -329,66 +384,77 @@ namespace PicView.UI.Animations
                         Properties.Settings.Default.BlueAlpha.R,
                         Properties.Settings.Default.BlueAlpha.G,
                         Properties.Settings.Default.BlueAlpha.B);
+
                 case 2:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.PinkAlpha.R,
                         Properties.Settings.Default.PinkAlpha.G,
                         Properties.Settings.Default.PinkAlpha.B);
+
                 case 3:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.OrangeAlpha.R,
                         Properties.Settings.Default.OrangeAlpha.G,
                         Properties.Settings.Default.OrangeAlpha.B);
+
                 case 4:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.GreenAlpha.R,
                         Properties.Settings.Default.GreenAlpha.G,
                         Properties.Settings.Default.GreenAlpha.B);
+
                 case 5:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.RedAlpha.R,
                         Properties.Settings.Default.RedAlpha.G,
                         Properties.Settings.Default.RedAlpha.B);
+
                 case 6:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.TealAlpha.R,
                         Properties.Settings.Default.TealAlpha.G,
                         Properties.Settings.Default.TealAlpha.B);
+
                 case 7:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.AquaAlpha.R,
                         Properties.Settings.Default.AquaAlpha.G,
                         Properties.Settings.Default.AquaAlpha.B);
+
                 case 8:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.BeigeAlpha.R,
                         Properties.Settings.Default.BeigeAlpha.G,
                         Properties.Settings.Default.BeigeAlpha.B);
+
                 case 9:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.PurpleAlpha.R,
                         Properties.Settings.Default.PurpleAlpha.G,
                         Properties.Settings.Default.PurpleAlpha.B);
+
                 case 10:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.CyanAlpha.R,
                         Properties.Settings.Default.CyanAlpha.G,
                         Properties.Settings.Default.CyanAlpha.B);
+
                 case 11:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.MagentaAlpha.R,
                         Properties.Settings.Default.MagentaAlpha.G,
                         Properties.Settings.Default.MagentaAlpha.B);
+
                 case 12:
                     return Color.FromArgb(
                         160,
@@ -409,66 +475,77 @@ namespace PicView.UI.Animations
                         Properties.Settings.Default.Blue.R,
                         Properties.Settings.Default.Blue.G,
                         Properties.Settings.Default.Blue.B);
+
                 case 2:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Pink.R,
                         Properties.Settings.Default.Pink.G,
                         Properties.Settings.Default.Pink.B);
+
                 case 3:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Orange.R,
                         Properties.Settings.Default.Orange.G,
                         Properties.Settings.Default.Orange.B);
+
                 case 4:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Green.R,
                         Properties.Settings.Default.Green.G,
                         Properties.Settings.Default.Green.B);
+
                 case 5:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Red.R,
                         Properties.Settings.Default.Red.G,
                         Properties.Settings.Default.Red.B);
+
                 case 6:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Teal.R,
                         Properties.Settings.Default.Teal.G,
                         Properties.Settings.Default.Teal.B);
+
                 case 7:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Aqua.R,
                         Properties.Settings.Default.Aqua.G,
                         Properties.Settings.Default.Aqua.B);
+
                 case 8:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Beige.R,
                         Properties.Settings.Default.Beige.G,
                         Properties.Settings.Default.Beige.B);
+
                 case 9:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Purple.R,
                         Properties.Settings.Default.Purple.G,
                         Properties.Settings.Default.Purple.B);
+
                 case 10:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Cyan.R,
                         Properties.Settings.Default.Cyan.G,
                         Properties.Settings.Default.Cyan.B);
+
                 case 11:
                     return Color.FromArgb(
                         160,
                         Properties.Settings.Default.Magenta.R,
                         Properties.Settings.Default.Magenta.G,
                         Properties.Settings.Default.Magenta.B);
+
                 case 12:
                     return Color.FromArgb(
                         160,
@@ -478,11 +555,11 @@ namespace PicView.UI.Animations
             }
         }
 
-        #endregion
+        #endregion Alpha
 
-        #endregion
+        #endregion Return Color
 
-        #endregion
+        #endregion Color stuff
 
         #region Size Animation
 
@@ -513,7 +590,6 @@ namespace PicView.UI.Animations
             item.innerborder.BeginAnimation(FrameworkElement.HeightProperty, da);
         }
 
-        #endregion
-
+        #endregion Size Animation
     }
-}
+}

+ 1 - 2
PicView/UI/Animations/FadeControls.cs

@@ -88,7 +88,6 @@ namespace PicView.UI.Animations
                 {
                     AnimationHelper.Fade(x2, 0, timespan);
                     AnimationHelper.Fade(minus, 0, timespan);
-
                 }
             }));
         }
@@ -111,4 +110,4 @@ namespace PicView.UI.Animations
             }
         }
     }
-}
+}

+ 6 - 10
PicView/UI/Animations/MouseOverAnimations.cs

@@ -1,13 +1,10 @@
 using System.Windows.Media;
-using System.Windows.Input;
-using static PicView.Library.Fields;
-
+using static PicView.UI.ConfigColors;
 
 namespace PicView.UI.Animations
 {
     internal static class MouseOverAnimations
     {
-
         /*
 
             Adds MouseOver events for the given elements with the AnimationHelper.
@@ -51,7 +48,7 @@ namespace PicView.UI.Animations
         //    AnimationHelper.PreviewMouseLeftButtonDownColorEvent(wBrush, false);
         //}
 
-        #endregion
+        #endregion logo
 
         #region 1x
 
@@ -110,7 +107,7 @@ namespace PicView.UI.Animations
             );
         }
 
-        #endregion
+        #endregion 1x
 
         #region 2x
 
@@ -132,7 +129,7 @@ namespace PicView.UI.Animations
             ButtonMouseLeaveAnim(brush2, transparent, alpha);
         }
 
-        #endregion
+        #endregion 2x
 
         #region 3x
 
@@ -157,7 +154,6 @@ namespace PicView.UI.Animations
             ButtonMouseLeaveAnim(brush3, transparent, alpha);
         }
 
-        #endregion
-
+        #endregion 3x
     }
-}
+}

+ 40 - 25
PicView/UI/ConfigColors.cs

@@ -9,6 +9,16 @@ namespace PicView.UI
 {
     public static class ConfigColors
     {
+        /// <summary>
+        /// Helper for user color settings
+        /// </summary>
+        internal static Color backgroundBorderColor;
+
+        /// <summary>
+        /// Helper for user color settings
+        /// </summary>
+        internal static Color mainColor;
+
         /// <summary>
         /// Update color values for brushes and window border
         /// </summary>
@@ -40,7 +50,6 @@ namespace PicView.UI
 #endif
                     //throw;
                 }
-
             }
         }
 
@@ -53,9 +62,11 @@ namespace PicView.UI
                 case 0:
                     mainWindow.imgBorder.Background = new SolidColorBrush(Colors.Transparent);
                     break;
+
                 case 1:
                     mainWindow.imgBorder.Background = new SolidColorBrush(Colors.White);
                     break;
+
                 case 2:
                     mainWindow.imgBorder.Background = DrawingBrushes.CheckerboardDrawingBrush(Colors.White);
                     break;
@@ -64,29 +75,11 @@ namespace PicView.UI
             backgroundBorderColor = (Color)Application.Current.Resources["BackgroundColorAlt"];
         }
 
-        public static void ChangeBackground()
-        {
-            ChangeBackground(null, null);
-        }
-
         public static void ChangeBackground(object sender, RoutedEventArgs e)
-        {
-            var brush = GetBackgroundColorBrush();
-            if (brush != null)
-            {
-                mainWindow.imgBorder.Background = brush;
-            }
-            else
-            {
-                mainWindow.imgBorder.Background = new SolidColorBrush(Colors.Transparent);
-            }
-        }
-
-        public static Brush GetBackgroundColorBrush()
         {
             if (mainWindow.imgBorder == null)
             {
-                return null;
+                return;
             }
 
             Properties.Settings.Default.BgColorChoice++;
@@ -104,14 +97,36 @@ namespace PicView.UI
                     {
                         goto case 1;
                     }
-                    return x;
+                    mainWindow.imgBorder.Background = x;
+                    break;
+
                 case 1:
-                    return new SolidColorBrush(Colors.White);
+                    mainWindow.imgBorder.Background = new SolidColorBrush(Colors.White);
+                    break;
+
                 case 2:
-                    return DrawingBrushes.CheckerboardDrawingBrush(Colors.White);
+                    var _ = DrawingBrushes.CheckerboardDrawingBrush(Colors.White);
+                    if (_ != null)
+                    {
+                        mainWindow.imgBorder.Background = _;
+                    }
+                    break;
+
                 default:
-                    return new SolidColorBrush(Colors.Transparent);
+                    mainWindow.imgBorder.Background = new SolidColorBrush(Colors.Transparent);
+                    break;
             }
         }
+
+        public static Brush GetBackgroundColorBrush()
+        {
+            return Properties.Settings.Default.BgColorChoice switch
+            {
+                0 => new SolidColorBrush(Colors.Transparent),
+                1 => new SolidColorBrush(Colors.White),
+                2 => DrawingBrushes.CheckerboardDrawingBrush(Colors.White),
+                _ => new SolidColorBrush(Colors.Transparent),
+            };
+        }
     }
-}
+}

+ 3 - 5
PicView/UI/DragAndDrop.cs

@@ -1,4 +1,5 @@
 using PicView.ChangeImage;
+using PicView.FileHandling;
 using PicView.UI.Loading;
 using System.Collections.Specialized;
 using System.Diagnostics;
@@ -8,11 +9,10 @@ using System.Text;
 using System.Threading.Tasks;
 using System.Windows;
 using System.Windows.Input;
-using static PicView.Library.Fields;
 using static PicView.ChangeImage.Navigation;
 using static PicView.ImageHandling.Thumbnails;
+using static PicView.Library.Fields;
 using static PicView.UI.Tooltip;
-using PicView.FileHandling;
 
 namespace PicView.UI
 {
@@ -194,7 +194,5 @@ namespace PicView.UI
             dragObj.SetFileDropList(new StringCollection() { Pics[FolderIndex] });
             DragDrop.DoDragDrop(senderElement, dragObj, DragDropEffects.Copy);
         }
-
-
     }
-}
+}

+ 1 - 2
PicView/UI/EditTitleBar.cs

@@ -87,5 +87,4 @@ namespace PicView.UI
             backupTitle = string.Empty;
         }
     }
-}
-
+}

+ 5 - 13
PicView/UI/HideInterfaceLogic.cs

@@ -1,16 +1,15 @@
-using System.Windows;
+using PicView.UI.PicGallery;
+using System.Windows;
 using System.Windows.Input;
-using static PicView.UI.Animations.FadeControls;
 using static PicView.Library.Fields;
+using static PicView.UI.Animations.FadeControls;
 using static PicView.UI.Sizing.ScaleImage;
 using static PicView.UI.UserControls.UC;
-using PicView.UI.PicGallery;
 
 namespace PicView.UI
 {
     internal static class HideInterfaceLogic
     {
-
         /// <summary>
         /// Toggle between hidden interface and default
         /// </summary>
@@ -84,7 +83,7 @@ namespace PicView.UI
         }
 
         /// <summary>
-        /// Toggle alternative layout navigation 
+        /// Toggle alternative layout navigation
         /// </summary>
         /// <param name="show"></param>
         internal static void ShowNavigation(bool show)
@@ -127,8 +126,6 @@ namespace PicView.UI
             }
         }
 
-
-
         /// <summary>
         /// Logic for mouse enter mainwindow event
         /// </summary>
@@ -154,7 +151,6 @@ namespace PicView.UI
             //FadeControlsAsync(true);
         }
 
-
         /// <summary>
         /// Logic for mouse movements on MainWindow
         /// </summary>
@@ -174,12 +170,10 @@ namespace PicView.UI
             //    HideCursorTimer.Stop();
             //}
 
-
             // If mouse moves on mainwindow, show elements
 
             FadeControlsAsync(true);
 
-
             //// If Slideshow is running the interface will hide after 2,5 sec.
             //if (Slidetimer.Enabled == true)
             //{
@@ -202,7 +196,5 @@ namespace PicView.UI
             //activityTimer.Start();
             FadeControlsAsync(false);
         }
-
-
     }
-}
+}

+ 1 - 1
PicView/UI/Loading/AjaxLoader.cs

@@ -40,4 +40,4 @@ namespace PicView.UI.Loading
             AnimationHelper.Fade(ajaxLoading, 0, TimeSpan.FromSeconds(.2));
         }
     }
-}
+}

+ 4 - 3
PicView/UI/Loading/EventsHandling.cs

@@ -1,4 +1,5 @@
 using PicView.FileHandling;
+using PicView.SystemIntegration;
 using PicView.UI.Animations;
 using PicView.UI.PicGallery;
 using System;
@@ -190,7 +191,6 @@ namespace PicView.UI.Loading
             //LocationChanged += MainWindow_LocationChanged;
             Microsoft.Win32.SystemEvents.DisplaySettingsChanged += SystemEvents_DisplaySettingsChanged;
 
-
 #if DEBUG
             Trace.WriteLine("Events loaded");
 #endif
@@ -205,8 +205,10 @@ namespace PicView.UI.Loading
                 case WindowState.Maximized:
                     SetWindowBehaviour = false;
                     break;
+
                 case WindowState.Normal:
                     break;
+
                 case WindowState.Minimized:
                     break;
             }
@@ -257,6 +259,5 @@ namespace PicView.UI.Loading
 #endif
             Environment.Exit(0);
         }
-
     }
-}
+}

+ 13 - 24
PicView/UI/Loading/LoadContextMenus.cs

@@ -1,18 +1,19 @@
-using System.Windows;
+using PicView.ImageHandling;
+using PicView.SystemIntegration;
+using PicView.UI.PicGallery;
+using PicView.UI.Sizing;
+using System.Diagnostics;
+using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Media;
 using static PicView.FileHandling.Copy_Paste;
 using static PicView.FileHandling.DeleteFiles;
-using static PicView.Library.Fields;
-using static PicView.Library.Utilities;
 using static PicView.FileHandling.Open_Save;
 using static PicView.FileHandling.RecentFiles;
+using static PicView.Library.Fields;
 using static PicView.Library.Resources.SvgIcons;
-using static PicView.Wallpaper;
-using System.Diagnostics;
-using PicView.UI.Sizing;
-using PicView.UI.PicGallery;
-using PicView.ImageHandling;
+using static PicView.Library.Utilities;
+using static PicView.SystemIntegration.Wallpaper;
 
 namespace PicView.UI.Loading
 {
@@ -24,7 +25,6 @@ namespace PicView.UI.Loading
             cm = new ContextMenu();
             var scbf = (SolidColorBrush)Application.Current.Resources["MainColorFadedBrush"];
 
-
             ///////////////////////////
             ///////////////////////////
             ///     Open           \\\\
@@ -46,7 +46,6 @@ namespace PicView.UI.Loading
             opencm.Click += (s, x) => Open();
             cm.Items.Add(opencm);
 
-
             ///////////////////////////
             ///////////////////////////
             ///     Save           \\\\
@@ -68,8 +67,6 @@ namespace PicView.UI.Loading
             savecm.Click += (s, x) => SaveFiles();
             cm.Items.Add(savecm);
 
-
-
             ///////////////////////////
             ///////////////////////////
             ///     Print          \\\\
@@ -112,7 +109,6 @@ namespace PicView.UI.Loading
             openwcm.Click += (s, x) => OpenWith(Pics[FolderIndex]);
             cm.Items.Add(openwcm);
 
-
             ///////////////////////////
             ///////////////////////////
             ///     Recent Files   \\\\
@@ -193,7 +189,6 @@ namespace PicView.UI.Loading
                 BorderThickness = new Thickness(0, 0, 0, 0),
                 MinWidth = 125,
                 IsChecked = Properties.Settings.Default.SortPreference == 2
-
             };
             sortcmChild2Header.Click += delegate { UpdateUIValues.ChangeSorting(2); cm.IsOpen = false; };
             sortcmChild2.Click += delegate { UpdateUIValues.ChangeSorting(2); cm.IsOpen = false; };
@@ -265,7 +260,6 @@ namespace PicView.UI.Loading
             sortcm.Items.Add(sortcmChild6);
             cm.Items.Add(sortcm);
 
-
             ///////////////////////////
             ///////////////////////////
             ///     Settings       \\\\
@@ -377,8 +371,9 @@ namespace PicView.UI.Loading
                 Width = double.NaN,
                 Height = double.NaN
             };
-            altcmHeader.Click += delegate {
-                if (GalleryFunctions.IsOpen) 
+            altcmHeader.Click += delegate
+            {
+                if (GalleryFunctions.IsOpen)
                 {
                     altcmHeader.IsChecked = Properties.Settings.Default.ShowInterface;
                     return;
@@ -432,7 +427,6 @@ namespace PicView.UI.Loading
             wallcm.Icon = wallcmIcon;
             cm.Items.Add(wallcm);
 
-
             ///////////////////////////
             ///////////////////////////
             ///   Locate on disk   \\\\
@@ -455,7 +449,6 @@ namespace PicView.UI.Loading
             lcdcm.Click += (s, x) => Open_In_Explorer();
             cm.Items.Add(lcdcm);
 
-
             ///////////////////////////
             ///////////////////////////
             ///   File Details     \\\\
@@ -497,7 +490,6 @@ namespace PicView.UI.Loading
             cpmIcon.Fill = scbf;
             cpm.Icon = cpmIcon;
 
-
             ///////////////////////////
             ///   Copy file        \\\\
             ///////////////////////////
@@ -542,8 +534,6 @@ namespace PicView.UI.Loading
             cppfm.Click += (s, x) => CopyText();
             cpm.Items.Add(cppfm);
 
-
-
             cm.Items.Add(cpm);
 
             ///////////////////////////
@@ -611,7 +601,6 @@ namespace PicView.UI.Loading
             MovetoRecycleBin.Click += (s, x) => DeleteFile(Pics[FolderIndex], true);
             cm.Items.Add(MovetoRecycleBin);
 
-
             ///////////////////////////
             ///////////////////////////
             ///   Close            \\\\
@@ -742,4 +731,4 @@ namespace PicView.UI.Loading
 #endif
         }
     }
-}
+}

+ 0 - 3
PicView/UI/Loading/LoadControls.cs

@@ -238,7 +238,6 @@ namespace PicView.UI.Loading
 #endif
         }
 
-
         /// <summary>
         /// Loads Croppingtool and adds it to the window
         /// </summary>
@@ -254,7 +253,5 @@ namespace PicView.UI.Loading
             Trace.WriteLine("cropppingTool loaded ");
 #endif
         }
-
-
     }
 }

+ 1 - 1
PicView/UI/Loading/LoadWindows.cs

@@ -140,4 +140,4 @@ namespace PicView.UI.Loading
 
         #endregion Windows
     }
-}
+}

+ 2 - 3
PicView/UI/Loading/StartLoading.cs

@@ -1,4 +1,5 @@
 using PicView.FileHandling;
+using PicView.SystemIntegration;
 using PicView.UI.PicGallery;
 using PicView.UI.UserControls;
 using System;
@@ -11,7 +12,6 @@ using static PicView.ChangeImage.Error_Handling;
 using static PicView.ChangeImage.Navigation;
 using static PicView.Library.Fields;
 using static PicView.Library.Resources.Timers;
-using static PicView.Library.Utilities;
 using static PicView.UI.Loading.AjaxLoader;
 using static PicView.UI.Loading.LoadContextMenus;
 using static PicView.UI.Loading.LoadControls;
@@ -56,7 +56,6 @@ namespace PicView.UI.Loading
 
         internal static void Start()
         {
-
 #if DEBUG
             Trace.WriteLine("ContentRendered started");
 #endif
@@ -192,4 +191,4 @@ namespace PicView.UI.Loading
 #endif
         }
     }
-}
+}

+ 5 - 7
PicView/UI/PicGallery/GalleryClick.cs

@@ -1,17 +1,16 @@
 using PicView.ChangeImage;
-using static PicView.UI.UserControls.UC;
 using System;
 using System.Windows;
 using System.Windows.Controls;
 using System.Windows.Media;
 using System.Windows.Media.Animation;
+using static PicView.ChangeImage.Navigation;
+using static PicView.ImageHandling.ImageDecoder;
+using static PicView.ImageHandling.Thumbnails;
 using static PicView.Library.Fields;
 using static PicView.UI.PicGallery.GalleryFunctions;
-using static PicView.ImageHandling.ImageDecoder;
-using static PicView.ChangeImage.Navigation;
 using static PicView.UI.Sizing.ScaleImage;
-using static PicView.ImageHandling.Thumbnails;
-using PicView.Library;
+using static PicView.UI.UserControls.UC;
 
 namespace PicView.UI.PicGallery
 {
@@ -135,6 +134,5 @@ namespace PicView.UI.PicGallery
             // Select next item
             SetSelected(id);
         }
-
     }
-}
+}

+ 9 - 9
PicView/UI/PicGallery/GalleryFunctions.cs

@@ -1,12 +1,11 @@
-using static PicView.UI.UserControls.UC;
-using System;
+using System;
 using System.Diagnostics;
 using System.Windows;
 using System.Windows.Media;
 using System.Windows.Media.Imaging;
 using System.Windows.Threading;
 using static PicView.Library.Fields;
-
+using static PicView.UI.UserControls.UC;
 
 namespace PicView.UI.PicGallery
 {
@@ -14,11 +13,13 @@ namespace PicView.UI.PicGallery
     {
         internal static bool IsLoading { get; set; }
 
-        static bool Open;
-        internal static bool IsOpen 
-        { 
+        private static bool Open;
+
+        internal static bool IsOpen
+        {
             get { return Open; }
-            set {
+            set
+            {
                 Open = value;
 #if DEBUG
                 Trace.WriteLine("IsOpen changed value to: " + IsOpen);
@@ -74,6 +75,5 @@ namespace PicView.UI.PicGallery
             prevItem.innerborder.BorderBrush = Application.Current.Resources["BorderBrush"] as SolidColorBrush;
             prevItem.innerborder.Width = prevItem.innerborder.Height = picGalleryItem_Size_s;
         }
-
     }
-}
+}

+ 1 - 2
PicView/UI/PicGallery/GalleryLoad.cs

@@ -2,11 +2,10 @@
 using System.Windows;
 using System.Windows.Controls;
 using static PicView.Library.Fields;
+using static PicView.UI.HideInterfaceLogic;
 using static PicView.UI.PicGallery.GalleryFunctions;
 using static PicView.UI.PicGallery.GalleryScroll;
-using static PicView.UI.HideInterfaceLogic;
 using static PicView.UI.UserControls.UC;
-using PicView.Library;
 
 namespace PicView.UI.PicGallery
 {

+ 7 - 9
PicView/UI/PicGallery/GalleryScroll.cs

@@ -3,7 +3,6 @@ using System.Windows.Input;
 using static PicView.Library.Fields;
 using static PicView.UI.UserControls.UC;
 
-
 namespace PicView.UI.PicGallery
 {
     // TODO Get scrolling calculation working for PicGallery 2
@@ -12,7 +11,7 @@ namespace PicView.UI.PicGallery
     {
         #region int calculations
 
-        static int Horizontal_items
+        private static int Horizontal_items
         {
             get
             {
@@ -25,7 +24,7 @@ namespace PicView.UI.PicGallery
             }
         }
 
-        static int Vertical_items
+        private static int Vertical_items
         {
             get
             {
@@ -40,7 +39,7 @@ namespace PicView.UI.PicGallery
             }
         }
 
-        static int Items_per_page
+        private static int Items_per_page
         {
             get
             {
@@ -55,7 +54,7 @@ namespace PicView.UI.PicGallery
             }
         }
 
-        static int Current_page
+        private static int Current_page
         {
             get
             {
@@ -71,7 +70,7 @@ namespace PicView.UI.PicGallery
         //     }
         // }
 
-        #endregion
+        #endregion int calculations
 
         #region ScrollTo
 
@@ -144,7 +143,6 @@ namespace PicView.UI.PicGallery
             }
         }
 
-        #endregion
-
+        #endregion ScrollTo
     }
-}
+}

+ 13 - 15
PicView/UI/PicGallery/GalleryToggle.cs

@@ -1,5 +1,4 @@
-using PicView.Library;
-using PicView.UI.Sizing;
+using PicView.UI.Sizing;
 using PicView.UI.Windows;
 using System;
 using System.Windows;
@@ -15,7 +14,7 @@ namespace PicView.UI.PicGallery
 {
     internal static class GalleryToggle
     {
-        #region Toggle 
+        #region Toggle
 
         internal static void Toggle(bool change = false)
         {
@@ -66,7 +65,7 @@ namespace PicView.UI.PicGallery
             }
         }
 
-        #endregion
+        #endregion Toggle
 
         #region Open
 
@@ -87,7 +86,7 @@ namespace PicView.UI.PicGallery
                 From = 0
             };
 
-            picGallery.BeginAnimation(UIElement.OpacityProperty, da);           
+            picGallery.BeginAnimation(UIElement.OpacityProperty, da);
 
             clickArrowLeft.Visibility =
             clickArrowRight.Visibility =
@@ -123,7 +122,7 @@ namespace PicView.UI.PicGallery
             LoadLayout();
 
             if (fakeWindow == null)
-            {                
+            {
                 fakeWindow = new FakeWindow();
             }
 
@@ -132,7 +131,6 @@ namespace PicView.UI.PicGallery
                 mainWindow.bg.Children.Remove(picGallery);
                 fakeWindow.grid.Children.Add(picGallery);
             }
-
             else if (!fakeWindow.grid.Children.Contains(picGallery))
             {
                 mainWindow.bg.Children.Remove(picGallery);
@@ -146,9 +144,9 @@ namespace PicView.UI.PicGallery
             if (!FreshStartup)
             {
                 ScaleImage.TryFitImage();
-            }            
+            }
 
-            // Fix not showing up opacity bug.. 
+            // Fix not showing up opacity bug..
             VisualStateManager.GoToElementState(picGallery, "Opacity", false);
 
             if (!IsLoading)
@@ -157,7 +155,7 @@ namespace PicView.UI.PicGallery
             }
         }
 
-        #endregion
+        #endregion Open
 
         #region Close
 
@@ -174,7 +172,8 @@ namespace PicView.UI.PicGallery
                 galleryShortcut.Visibility = Visibility.Visible;
             }
 
-            var da = new DoubleAnimation {
+            var da = new DoubleAnimation
+            {
                 Duration = TimeSpan.FromSeconds(.5),
                 From = 1,
                 To = 0,
@@ -200,7 +199,7 @@ namespace PicView.UI.PicGallery
             HideInterfaceLogic.ShowStandardInterface();
         }
 
-        #endregion
+        #endregion Close
 
         #region Change
 
@@ -243,7 +242,6 @@ namespace PicView.UI.PicGallery
             mainWindow.Focus();
         }
 
-        #endregion
-
+        #endregion Change
     }
-}
+}

+ 1 - 1
PicView/UI/SetTitle.cs

@@ -97,4 +97,4 @@ namespace PicView.UI
             mainWindow.Bar.ToolTip = titleString[1];
         }
     }
-}
+}

+ 5 - 6
PicView/UI/Sizing/ScaleImage.cs

@@ -1,8 +1,8 @@
-using System;
+using PicView.ImageHandling;
+using System;
 using static PicView.Library.Fields;
-using static PicView.UI.TransformImage.Scroll;
 using static PicView.UI.Sizing.WindowLogic;
-using PicView.ImageHandling;
+using static PicView.UI.TransformImage.Scroll;
 
 namespace PicView.UI.Sizing
 {
@@ -200,7 +200,7 @@ namespace PicView.UI.Sizing
             else
             {
                 /// Fix title width to window size
-                mainWindow.Bar.MaxWidth = mainWindow.ActualWidth - interfaceSize; 
+                mainWindow.Bar.MaxWidth = mainWindow.ActualWidth - interfaceSize;
             }
 
             if (isZoomed)
@@ -233,5 +233,4 @@ namespace PicView.UI.Sizing
             */
         }
     }
-}
-
+}

+ 5 - 11
PicView/UI/Sizing/WindowLogic.cs

@@ -1,9 +1,9 @@
-using PicView.UI.Windows;
+using PicView.SystemIntegration;
+using PicView.UI.Windows;
 using System;
 using System.Windows;
 using System.Windows.Input;
 using static PicView.Library.Fields;
-using static PicView.Library.Utilities;
 using static PicView.UI.HideInterfaceLogic;
 using static PicView.UI.Sizing.ScaleImage;
 using static PicView.UI.UserControls.UC;
@@ -38,7 +38,6 @@ namespace PicView.UI.Sizing
                     }
 
                     mainWindow.WindowState = WindowState.Normal;
-
                 }
                 else
                 {
@@ -85,7 +84,6 @@ namespace PicView.UI.Sizing
                 return;
             }
 
-
             if (e.ClickCount == 2)
             {
                 Maximize_Restore();
@@ -120,7 +118,6 @@ namespace PicView.UI.Sizing
             }
         }
 
-
         /// <summary>
         /// Function made to restore and drag window from maximized windowstate
         /// </summary>
@@ -283,15 +280,13 @@ namespace PicView.UI.Sizing
 
                     mainWindow.bg.Width = double.NaN;
                     mainWindow.bg.Height = double.NaN;
-                    
                 }
 
                 TryFitImage();
-                ConfigColors.UpdateColor(); // Regain border              
+                ConfigColors.UpdateColor(); // Regain border
 
                 Properties.Settings.Default.Fullscreen = false;
             }
-
         }
 
         /// <summary>
@@ -302,9 +297,8 @@ namespace PicView.UI.Sizing
             //move to the centre
             mainWindow.Left = (((MonitorInfo.WorkArea.Width - (mainWindow.Width * MonitorInfo.DpiScaling)) / 2) + (MonitorInfo.WorkArea.Left * MonitorInfo.DpiScaling));
             mainWindow.Top = ((MonitorInfo.WorkArea.Height - (mainWindow.Height * MonitorInfo.DpiScaling)) / 2) + (MonitorInfo.WorkArea.Top * MonitorInfo.DpiScaling);
-
         }
 
-        #endregion
+        #endregion Window Functions
     }
-}
+}

+ 7 - 6
PicView/UI/SlideShow.cs

@@ -1,11 +1,12 @@
-using System;
+using PicView.SystemIntegration;
+using PicView.UI.Animations;
+using PicView.UI.UserControls;
+using System;
 using System.Timers;
 using System.Windows.Threading;
-using static PicView.Library.Fields;
 using static PicView.ChangeImage.Navigation;
+using static PicView.Library.Fields;
 using static PicView.UI.Sizing.WindowLogic;
-using PicView.UI.Animations;
-using PicView.UI.UserControls;
 
 namespace PicView.UI
 {
@@ -67,10 +68,10 @@ namespace PicView.UI
         {
             await mainWindow.Dispatcher.BeginInvoke(DispatcherPriority.Normal, new Action(() =>
             {
-                AnimationHelper.Fade(mainWindow.img, TimeSpan.FromSeconds(0.8), TimeSpan.FromSeconds(0), 0, .5);               
+                AnimationHelper.Fade(mainWindow.img, TimeSpan.FromSeconds(0.8), TimeSpan.FromSeconds(0), 0, .5);
                 Pic();
                 AnimationHelper.Fade(mainWindow.img, TimeSpan.FromSeconds(0.7), TimeSpan.FromSeconds(0), .5, 1);
             }));
         }
     }
-}
+}

+ 0 - 1
PicView/UI/Styles/Backgrounds.xaml

@@ -6,5 +6,4 @@
         TileMode="FlipXY"
         Viewport="0,0,100,100"
         ViewportUnits="Absolute" />
-
 </ResourceDictionary>

+ 0 - 2
PicView/UI/Styles/Border.xaml

@@ -15,7 +15,5 @@
                     Color="Black" />
             </Setter.Value>
         </Setter>
-
     </Style>
-
 </ResourceDictionary>

+ 0 - 2
PicView/UI/Styles/Button.xaml

@@ -18,7 +18,6 @@
         </Setter>
     </Style>
 
-
     <Style TargetType="CheckBox">
         <Setter Property="FontFamily" Value="/PicView;component/Library/Resources/fonts/#Aller" />
         <Setter Property="Background" Value="Transparent" />
@@ -107,5 +106,4 @@
             </Setter.Value>
         </Setter>
     </Style>
-
 </ResourceDictionary>

+ 0 - 6
PicView/UI/Styles/Colors.xaml

@@ -51,10 +51,4 @@
     <Color x:Key="AltInterfaceW">#A7171717</Color>
     <SolidColorBrush x:Key="AltInterfaceBrush" Color="{StaticResource AltInterface}" />
     <SolidColorBrush x:Key="AltInterfaceWBrush" Color="{StaticResource AltInterfaceW}" />
-
-
-
-
-
-
 </ResourceDictionary>

+ 1 - 1
PicView/UI/Styles/FlatSlider.xaml

@@ -258,4 +258,4 @@
             </Trigger>
         </Style.Triggers>
     </Style>
-</ResourceDictionary>
+</ResourceDictionary>

+ 1 - 2
PicView/UI/Styles/Menu.xaml

@@ -5,7 +5,6 @@
     xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
     mc:Ignorable="d">
 
-
     <!--  SimpleStyles: Menu  -->
     <!--<SnippetMenu>-->
     <Style x:Key="{x:Type Menu}" TargetType="{x:Type Menu}">
@@ -202,7 +201,7 @@
         <Setter Property="Template">
             <Setter.Value>
                 <ControlTemplate TargetType="{x:Type Separator}">
-                    <Border BorderBrush="#FF2B2727" BorderThickness="2"/>
+                    <Border BorderBrush="#FF2B2727" BorderThickness="2" />
                 </ControlTemplate>
             </Setter.Value>
         </Setter>

+ 0 - 1
PicView/UI/Styles/MyWindowStyle.xaml

@@ -38,5 +38,4 @@
             </Setter.Value>
         </Setter>
     </Style>
-
 </ResourceDictionary>

+ 0 - 2
PicView/UI/Styles/ProgressBar.xaml

@@ -33,7 +33,6 @@
                                         </GradientStopCollection>
                                     </GradientBrush.GradientStops>
                                 </LinearGradientBrush>
-
                             </Border.BorderBrush>
                             <Grid x:Name="Animation" ClipToBounds="True">
                                 <Rectangle
@@ -59,7 +58,6 @@
                                                 </DiscreteObjectKeyFrame.Value>
                                             </DiscreteObjectKeyFrame>
                                         </ObjectAnimationUsingKeyFrames>
-
                                     </Storyboard>
                                 </VisualState>
                             </VisualStateGroup>

+ 0 - 6
PicView/UI/Styles/RadioButton.xaml

@@ -70,7 +70,6 @@
                             <Setter TargetName="TickMark" Property="Visibility" Value="Visible" />
                             <Setter TargetName="CrossMark" Property="Visibility" Value="Collapsed" />
                         </Trigger>
-
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
@@ -158,7 +157,6 @@
                             <Setter TargetName="TickMark" Property="Visibility" Value="Visible" />
                             <Setter TargetName="CrossMark" Property="Visibility" Value="Collapsed" />
                         </Trigger>
-
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
@@ -247,7 +245,6 @@
                             <Setter TargetName="TickMark" Property="Visibility" Value="Visible" />
                             <Setter TargetName="CrossMark" Property="Visibility" Value="Collapsed" />
                         </Trigger>
-
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
@@ -336,7 +333,6 @@
                             <Setter TargetName="TickMark" Property="Visibility" Value="Visible" />
                             <Setter TargetName="CrossMark" Property="Visibility" Value="Collapsed" />
                         </Trigger>
-
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
@@ -413,11 +409,9 @@
                             <Setter TargetName="TickMark" Property="Visibility" Value="Visible" />
                             <Setter TargetName="CrossMark" Property="Visibility" Value="Collapsed" />
                         </Trigger>
-
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
     </Style>
-
 </ResourceDictionary>

+ 0 - 1
PicView/UI/Styles/ScrollBar.xaml

@@ -160,7 +160,6 @@
                             Data="M10.804,9.844L1.154,0.195C1.025,0.064,0.857,0,0.683,0C0.512,0,0.34,0.064,0.21,0.195L0.197,0.207  C0.071,0.334,0,0.506,0,0.682v4.682c0,0.178,0.071,0.348,0.197,0.471l4.481,4.482l-4.481,4.479C0.071,14.922,0,15.09,0,15.271v4.68  c0,0.18,0.071,0.354,0.197,0.475l0.013,0.01c0.124,0.127,0.294,0.197,0.473,0.197s0.348-0.07,0.474-0.197l9.647-9.646  C11.064,10.531,11.064,10.104,10.804,9.844z"
                             Fill="{StaticResource MainColorBrush}"
                             Stretch="None" />
-
                     </Grid>
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsMouseOver" Value="true">

+ 0 - 2
PicView/UI/Styles/Separator.xaml

@@ -14,6 +14,4 @@
             </Setter.Value>
         </Setter>
     </Style>
-
-
 </ResourceDictionary>

+ 0 - 1
PicView/UI/Styles/Slider.xaml

@@ -189,7 +189,6 @@
                             </GradientStopCollection>
                         </LinearGradientBrush.GradientStops>
                     </LinearGradientBrush>
-
                 </Border.BorderBrush>
                 <Border.Background>
                     <LinearGradientBrush StartPoint="0.25,0" EndPoint="1,0">

+ 1 - 1
PicView/UI/Styles/TabControl.xaml

@@ -75,7 +75,7 @@
     -->
     <!--<Setter TargetName="Border" Property="Effect">
             <Setter.Value>
-                <BlurEffect Radius="7" RenderingBias="Quality"/>
+                <BlurEffect Radius="7" RenderingBias="Quality" />
             </Setter.Value>
             </Setter>-->
     <!--

+ 0 - 1
PicView/UI/Styles/TextBox.xaml

@@ -39,5 +39,4 @@
             </Setter.Value>
         </Setter>
     </Style>
-
 </ResourceDictionary>

+ 0 - 3
PicView/UI/Styles/ToggleButton.xaml

@@ -64,18 +64,15 @@
                         </BulletDecorator>
                     </Border>
 
-
                     <!--  If item is checked, trigger the visibility of the mark  -->
                     <ControlTemplate.Triggers>
                         <Trigger Property="IsChecked" Value="true">
                             <Setter TargetName="TickMark" Property="Visibility" Value="Visible" />
                             <Setter TargetName="CrossMark" Property="Visibility" Value="Collapsed" />
                         </Trigger>
-
                     </ControlTemplate.Triggers>
                 </ControlTemplate>
             </Setter.Value>
         </Setter>
     </Style>
-
 </ResourceDictionary>

+ 16 - 14
PicView/UI/Styles/ToolBar.xaml

@@ -2,11 +2,13 @@
                     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                     xmlns:sys="clr-namespace:System;assembly=mscorlib">
 
-  <!--<ResourceDictionary.MergedDictionaries>
+    <!--<ResourceDictionary.MergedDictionaries>
     <ResourceDictionary Source="Shared.xaml" />
   </ResourceDictionary.MergedDictionaries>
 
-  --><!--<SnippetToolBar>--><!--
+  -->
+    <!--<SnippetToolBar>-->
+    <!--
   <Style x:Key="ToolBarButtonBaseStyle"
          TargetType="{x:Type ButtonBase}">
     <Setter Property="SnapsToDevicePixels"
@@ -62,7 +64,7 @@
                 <VisualState x:Name="Disabled">
                   <Storyboard>
                     <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
-                                                  Storyboard.TargetProperty="(Panel.Background). 
+                                                  Storyboard.TargetProperty="(Panel.Background).
                       (GradientBrush.GradientStops)[1].(GradientStop.Color)">
                       <EasingColorKeyFrame KeyTime="0"
                                            Value="{StaticResource DisabledControlDarkColor}" />
@@ -128,8 +130,8 @@
                   BorderThickness="1">
                         <Border.Background>
                             <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
-                                <GradientStop Color="#B28F8F8F" Offset="0"/>
-                                <GradientStop Color="#CC000000" Offset="1"/>
+                                <GradientStop Color="#B28F8F8F" Offset="0" />
+                                <GradientStop Color="#CC000000" Offset="1" />
                             </LinearGradientBrush>
                         </Border.Background>
                         <Border.BorderBrush>
@@ -141,13 +143,13 @@
                 <VisualState x:Name="Disabled">
                   <Storyboard>
                     <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
-                                                  Storyboard.TargetProperty="(Panel.Background).  
+                                                  Storyboard.TargetProperty="(Panel.Background).
                       (SolidColorBrush.Color)">
                       <EasingColorKeyFrame KeyTime="0"
                                            Value="{StaticResource DisabledControlDarkColor}" />
                     </ColorAnimationUsingKeyFrames>
                     <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
-                                                  Storyboard.TargetProperty="(Border.BorderBrush).  
+                                                  Storyboard.TargetProperty="(Border.BorderBrush).
                       (SolidColorBrush.Color)">
                       <EasingColorKeyFrame KeyTime="0"
                                            Value="{StaticResource DisabledBorderLightColor}" />
@@ -223,7 +225,7 @@
                 <VisualState x:Name="Pressed">
                   <Storyboard>
                     <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
-                                                  Storyboard.TargetProperty="(Panel.Background).    
+                                                  Storyboard.TargetProperty="(Panel.Background).
                       (GradientBrush.GradientStops)[1].(GradientStop.Color)">
                       <EasingColorKeyFrame KeyTime="0"
                                            Value="{StaticResource ControlPressedColor}" />
@@ -233,7 +235,7 @@
                 <VisualState x:Name="MouseOver">
                   <Storyboard>
                     <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
-                                                  Storyboard.TargetProperty="(Panel.Background).     
+                                                  Storyboard.TargetProperty="(Panel.Background).
                       (GradientBrush.GradientStops)[1].(GradientStop.Color)">
                       <EasingColorKeyFrame KeyTime="0"
                                            Value="{StaticResource ControlMouseOverColor}" />
@@ -243,7 +245,7 @@
                 <VisualState x:Name="Disabled">
                   <Storyboard>
                     <ColorAnimationUsingKeyFrames Storyboard.TargetName="Border"
-                                                  Storyboard.TargetProperty="(Panel.Background).   
+                                                  Storyboard.TargetProperty="(Panel.Background).
                       (GradientBrush.GradientStops)[1].(GradientStop.Color)">
                       <EasingColorKeyFrame KeyTime="0"
                                            Value="{StaticResource DisabledBorderLightColor}" />
@@ -310,7 +312,7 @@
                             IsEnabled="{TemplateBinding HasOverflowItems}"
                             Style="{StaticResource ToolBarOverflowButtonStyle}"
                             ClickMode="Press"
-                            IsChecked="{Binding IsOverflowOpen, Mode=TwoWay, 
+                            IsChecked="{Binding IsOverflowOpen, Mode=TwoWay,
                 RelativeSource={RelativeSource TemplatedParent}}">
                 <Popup x:Name="OverflowPopup"
                        AllowsTransparency="true"
@@ -318,7 +320,7 @@
                        StaysOpen="false"
                        Focusable="false"
                        PopupAnimation="Slide"
-                       IsOpen="{Binding IsOverflowOpen, 
+                       IsOpen="{Binding IsOverflowOpen,
                   RelativeSource={RelativeSource TemplatedParent}}">
                   <Border x:Name="DropDownBorder"
                           BorderThickness="1">
@@ -389,5 +391,5 @@
       </Setter.Value>
     </Setter>
   </Style>-->
-  <!--</SnippetToolBar>-->
-</ResourceDictionary>
+    <!--</SnippetToolBar>-->
+</ResourceDictionary>

+ 1 - 2
PicView/UI/Styles/ToolTip.xaml

@@ -7,7 +7,7 @@
         <Setter Property="FontFamily" Value="/PicView;component/Library/Resources/fonts/#TeX Gyre Heros" />
         <Setter Property="FontSize" Value="12" />
         <Setter Property="Foreground" Value="{StaticResource MainColorBrush}" />
-        <!--<Setter Property="BorderThickness" Value="1"/>
+        <!--<Setter Property="BorderThickness" Value="1" />
         <Setter Property="BorderBrush" Value="#F90F0F0F" />-->
         <Setter Property="Template">
             <Setter.Value>
@@ -37,5 +37,4 @@
         </Setter>
     </Style>
     <!--</SnippetToolTip>-->
-
 </ResourceDictionary>

+ 1 - 2
PicView/UI/Tooltip.cs

@@ -57,6 +57,5 @@ namespace PicView.UI
         {
             toolTipMessage.Visibility = Visibility.Hidden;
         }
-
     }
-}
+}

+ 1 - 3
PicView/UI/TransformImage/Rotation.cs

@@ -1,6 +1,5 @@
 using PicView.UI.PicGallery;
 using PicView.UI.Sizing;
-using System;
 using System.Windows.Media;
 using static PicView.Library.Fields;
 
@@ -48,7 +47,6 @@ namespace PicView.UI.TransformImage
             if (mainWindow.img.Source == null ||
                 Properties.Settings.Default.PicGallery == 1 && GalleryFunctions.IsOpen)
             { return; }
-            
 
             if (right)
             {
@@ -95,4 +93,4 @@ namespace PicView.UI.TransformImage
             mainWindow.img.LayoutTransform = tg;
         }
     }
-}
+}

+ 1 - 1
PicView/UI/TransformImage/Scroll.cs

@@ -111,4 +111,4 @@ namespace PicView.UI.TransformImage
             }));
         }
     }
-}
+}

+ 35 - 11
PicView/UI/TransformImage/Zoom.cs

@@ -1,15 +1,16 @@
-using System;
+using PicView.UI.PicGallery;
+using PicView.UI.Sizing;
+using System;
+using System.Diagnostics;
 using System.Linq;
+using System.Text.RegularExpressions;
 using System.Windows;
 using System.Windows.Input;
 using System.Windows.Media;
-using static PicView.Library.Fields;
 using static PicView.ChangeImage.Navigation;
+using static PicView.Library.Fields;
 using static PicView.Library.Utilities;
 using static PicView.UI.Sizing.WindowLogic;
-using PicView.UI.Sizing;
-using PicView.Library;
-using PicView.UI.PicGallery;
 
 namespace PicView.UI.TransformImage
 {
@@ -254,12 +255,24 @@ namespace PicView.UI.TransformImage
             // Display non-zoomed values
             if (CanNavigate)
             {
-               SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, FolderIndex);
+                SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, FolderIndex);
             }
             else
             {
                 // Display values from web
-                SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, Pics[FolderIndex]);
+                try
+                {
+                    var linkParser = new Regex(@"\b(?:https?://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+                    var txt = linkParser.Match(mainWindow.Bar.Text).ToString();
+                    SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, txt);
+                }
+                catch (Exception e)
+                {
+                    SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, "Custom image");
+#if DEBUG
+                    Trace.WriteLine(e.Message);
+#endif
+                }
             }
 
             isZoomed = false;
@@ -336,7 +349,6 @@ namespace PicView.UI.TransformImage
                 }
                 //zoomValue = i > 0 ? zoomValue : -zoomValue;
                 //st.ScaleY = st.ScaleX += zoomValue;
-
             }
 
             isZoomed = true;
@@ -344,7 +356,7 @@ namespace PicView.UI.TransformImage
             /// Displays zoompercentage in the center window
             if (!string.IsNullOrEmpty(ZoomPercentage))
             {
-               Tooltip.ShowTooltipMessage(ZoomPercentage, true);
+                Tooltip.ShowTooltipMessage(ZoomPercentage, true);
             }
             else
             {
@@ -359,8 +371,20 @@ namespace PicView.UI.TransformImage
             else
             {
                 /// Display values from web
-                SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, Pics[FolderIndex]);
+                try
+                {
+                    var linkParser = new Regex(@"\b(?:https?://|www\.)\S+\b", RegexOptions.Compiled | RegexOptions.IgnoreCase);
+                    var txt = linkParser.Match(mainWindow.Bar.Text).ToString();
+                    SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, txt);
+                }
+                catch (Exception e)
+                {
+                    SetTitle.SetTitleString((int)mainWindow.img.Source.Width, (int)mainWindow.img.Source.Height, "Custom image");
+#if DEBUG
+                    Trace.WriteLine(e.Message);
+#endif
+                }
             }
         }
     }
-}
+}

+ 15 - 11
PicView/UI/UpdateUIValues.cs

@@ -1,21 +1,19 @@
-using System.IO;
+using PicView.UI.PicGallery;
+using PicView.UI.Sizing;
+using PicView.UI.UserControls;
+using System.IO;
 using System.Windows;
 using System.Windows.Controls;
-using static PicView.Library.Fields;
-using static PicView.FileHandling.FileLists;
 using static PicView.ChangeImage.Navigation;
-using static PicView.UI.TransformImage.Scroll;
+using static PicView.FileHandling.FileLists;
+using static PicView.Library.Fields;
 using static PicView.UI.Tooltip;
-using PicView.UI.PicGallery;
-using PicView.UI.UserControls;
-using PicView.UI.Sizing;
-using PicView.Library;
+using static PicView.UI.TransformImage.Scroll;
 
 namespace PicView.UI
 {
     internal static class UpdateUIValues
     {
-
         internal static void ChangeSorting(short sorting)
         {
             if (Properties.Settings.Default.SortPreference == sorting)
@@ -65,6 +63,7 @@ namespace PicView.UI
                     sort5Header.IsChecked = false;
                     sort6Header.IsChecked = false;
                     break;
+
                 case 1:
                     sort0Header.IsChecked = false;
                     sort1Header.IsChecked = true;
@@ -74,6 +73,7 @@ namespace PicView.UI
                     sort5Header.IsChecked = false;
                     sort6Header.IsChecked = false;
                     break;
+
                 case 2:
                     sort0Header.IsChecked = false;
                     sort1Header.IsChecked = false;
@@ -83,6 +83,7 @@ namespace PicView.UI
                     sort5Header.IsChecked = false;
                     sort6Header.IsChecked = false;
                     break;
+
                 case 3:
                     sort0Header.IsChecked = false;
                     sort1Header.IsChecked = false;
@@ -92,6 +93,7 @@ namespace PicView.UI
                     sort5Header.IsChecked = false;
                     sort6Header.IsChecked = false;
                     break;
+
                 case 4:
                     sort0Header.IsChecked = false;
                     sort1Header.IsChecked = false;
@@ -101,6 +103,7 @@ namespace PicView.UI
                     sort5Header.IsChecked = false;
                     sort6Header.IsChecked = false;
                     break;
+
                 case 5:
                     sort0Header.IsChecked = false;
                     sort1Header.IsChecked = false;
@@ -110,6 +113,7 @@ namespace PicView.UI
                     sort5Header.IsChecked = true;
                     sort6Header.IsChecked = false;
                     break;
+
                 case 6:
                     sort0Header.IsChecked = false;
                     sort1Header.IsChecked = false;
@@ -122,7 +126,6 @@ namespace PicView.UI
             }
         }
 
-
         internal static void SetScrolling(object sender, RoutedEventArgs e)
         {
             var settingscm = cm.Items[7] as MenuItem;
@@ -278,9 +281,10 @@ namespace PicView.UI
                 case "15":
                     Properties.Settings.Default.SlideTimer = 15000;
                     break;
+
                 default:
                     break;
             }
         }
     }
-}
+}

+ 2 - 2
PicView/UI/UserControls/Buttons/ClickArrow.xaml

@@ -12,7 +12,7 @@
         BorderThickness="1,1,0,1"
         CornerRadius="2,0,0,2">
         <Border.BorderBrush>
-            <SolidColorBrush x:Name="BorderBrushKey" Color="{StaticResource BorderColor}"/>
+            <SolidColorBrush x:Name="BorderBrushKey" Color="{StaticResource BorderColor}" />
         </Border.BorderBrush>
         <Canvas x:Name="canvas">
             <Polygon
@@ -33,4 +33,4 @@
             </Canvas.Background>
         </Canvas>
     </Border>
-</UserControl>
+</UserControl>

+ 0 - 3
PicView/UI/UserControls/Buttons/ClickArrow.xaml.cs

@@ -51,7 +51,6 @@ namespace PicView.UI.UserControls
                 ccAnim.To = AnimationHelper.GetPrefferedColorDown();
                 PolyFill.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
                 AnimationHelper.MouseOverColorEvent(alpha.A, alpha.R, alpha.G, alpha.B, BorderBrushKey, true);
-
             };
 
             MouseEnter += (sender, e) =>
@@ -66,7 +65,6 @@ namespace PicView.UI.UserControls
                     {
                         Duration = TimeSpan.FromSeconds(.2)
                     };
-
                 }
 
                 ccAnim.From = fg;
@@ -77,7 +75,6 @@ namespace PicView.UI.UserControls
                 ccAnim2.To = bg2;
                 CanvasBGcolor.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim2);
                 AnimationHelper.MouseOverColorEvent(bb.A, bb.R, bb.G, bb.B, BorderBrushKey, true);
-
             };
             MouseLeave += (sender, e) =>
             {

+ 1 - 1
PicView/UI/UserControls/Buttons/CloseButton.xaml

@@ -23,4 +23,4 @@
             SnapsToDevicePixels="True"
             Stretch="Fill" />
     </Button>
-</UserControl>
+</UserControl>

+ 1 - 3
PicView/UI/UserControls/Buttons/CloseButton.xaml.cs

@@ -15,8 +15,6 @@ namespace PicView.UI.UserControls
                 MouseEnter += (s, x) => ButtonMouseOverAnim(CloseButtonBrush, true);
                 MouseLeave += (s, x) => ButtonMouseLeaveAnim(CloseButtonBrush, true);
             };
-
-
         }
     }
-}
+}

+ 1 - 1
PicView/UI/UserControls/Buttons/FullscreenButton.xaml

@@ -24,4 +24,4 @@
             SnapsToDevicePixels="True"
             Stretch="Fill" />
     </Button>
-</UserControl>
+</UserControl>

+ 1 - 1
PicView/UI/UserControls/Buttons/FullscreenButton.xaml.cs

@@ -17,4 +17,4 @@ namespace PicView.UI.UserControls
             };
         }
     }
-}
+}

+ 1 - 4
PicView/UI/UserControls/Buttons/GalleryShortcut.xaml.cs

@@ -45,7 +45,6 @@ namespace PicView.UI.UserControls
                 ImagePath2Fill.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
                 ImagePath3Fill.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
                 AnimationHelper.MouseOverColorEvent(alpha.A, alpha.R, alpha.G, alpha.B, BorderBrushKey, true);
-
             };
 
             MouseEnter += (sender, e) =>
@@ -60,7 +59,6 @@ namespace PicView.UI.UserControls
                     {
                         Duration = TimeSpan.FromSeconds(.2)
                     };
-
                 }
 
                 ccAnim.From = fg;
@@ -73,7 +71,6 @@ namespace PicView.UI.UserControls
                 ccAnim2.To = bg2;
                 CanvasBGcolor.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim2);
                 AnimationHelper.MouseOverColorEvent(bb.A, bb.R, bb.G, bb.B, BorderBrushKey, true);
-
             };
             MouseLeave += (sender, e) =>
             {
@@ -102,4 +99,4 @@ namespace PicView.UI.UserControls
             };
         }
     }
-}
+}

+ 1 - 1
PicView/UI/UserControls/Buttons/MenuCloseButton.xaml

@@ -23,4 +23,4 @@
             SnapsToDevicePixels="True"
             Stretch="Fill" />
     </Button>
-</UserControl>
+</UserControl>

+ 1 - 1
PicView/UI/UserControls/Buttons/MenuCloseButton.xaml.cs

@@ -18,4 +18,4 @@ namespace PicView.UI.UserControls
             };
         }
     }
-}
+}

+ 1 - 1
PicView/UI/UserControls/Buttons/MinButton.xaml

@@ -21,4 +21,4 @@
             Fill="{StaticResource MainColorBrush}"
             SnapsToDevicePixels="True" />
     </Button>
-</UserControl>
+</UserControl>

+ 1 - 3
PicView/UI/UserControls/Buttons/MinButton.xaml.cs

@@ -15,8 +15,6 @@ namespace PicView.UI.UserControls
                 MouseEnter += (s, x) => ButtonMouseOverAnim(MinButtonBrush, true);
                 MouseLeave += (s, x) => ButtonMouseLeaveAnim(MinButtonBrush, true);
             };
-
-
         }
     }
-}
+}

+ 1 - 1
PicView/UI/UserControls/Buttons/Minus.xaml

@@ -28,4 +28,4 @@
             </Path>
         </Viewbox>
     </Border>
-</UserControl>
+</UserControl>

+ 1 - 4
PicView/UI/UserControls/Buttons/Minus.xaml.cs

@@ -43,7 +43,6 @@ namespace PicView.UI.UserControls
                 ccAnim.To = AnimationHelper.GetPrefferedColorDown();
                 PolyFill.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
                 AnimationHelper.MouseOverColorEvent(alpha.A, alpha.R, alpha.G, alpha.B, BorderBrushKey, true);
-
             };
 
             MouseEnter += (sender, e) =>
@@ -58,7 +57,6 @@ namespace PicView.UI.UserControls
                     {
                         Duration = TimeSpan.FromSeconds(.2)
                     };
-
                 }
 
                 ccAnim.From = fg;
@@ -69,7 +67,6 @@ namespace PicView.UI.UserControls
                 ccAnim2.To = bg2;
                 CanvasBGcolor.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim2);
                 AnimationHelper.MouseOverColorEvent(bb.A, bb.R, bb.G, bb.B, BorderBrushKey, true);
-
             };
             MouseLeave += (sender, e) =>
             {
@@ -96,4 +93,4 @@ namespace PicView.UI.UserControls
             };
         }
     }
-}
+}

+ 1 - 1
PicView/UI/UserControls/Buttons/X2.xaml

@@ -29,4 +29,4 @@
             </Path>
         </Viewbox>
     </Border>
-</UserControl>
+</UserControl>

+ 1 - 4
PicView/UI/UserControls/Buttons/X2.xaml.cs

@@ -43,7 +43,6 @@ namespace PicView.UI.UserControls
                 ccAnim.To = AnimationHelper.GetPrefferedColorDown();
                 PolyFill.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim);
                 AnimationHelper.MouseOverColorEvent(alpha.A, alpha.R, alpha.G, alpha.B, BorderBrushKey, true);
-
             };
 
             MouseEnter += (sender, e) =>
@@ -58,7 +57,6 @@ namespace PicView.UI.UserControls
                     {
                         Duration = TimeSpan.FromSeconds(.2)
                     };
-
                 }
 
                 ccAnim.From = fg;
@@ -69,7 +67,6 @@ namespace PicView.UI.UserControls
                 ccAnim2.To = bg2;
                 CanvasBGcolor.BeginAnimation(SolidColorBrush.ColorProperty, ccAnim2);
                 AnimationHelper.MouseOverColorEvent(bb.A, bb.R, bb.G, bb.B, BorderBrushKey, true);
-
             };
             MouseLeave += (sender, e) =>
             {
@@ -96,4 +93,4 @@ namespace PicView.UI.UserControls
             };
         }
     }
-}
+}

+ 0 - 1
PicView/UI/UserControls/Gallery/PicGallery.xaml.cs

@@ -14,6 +14,5 @@ namespace PicView.UI.UserControls
             //PicGalleryLogic.IsLoading = PicGalleryLogic.IsOpen = false;
             Loaded += GalleryLoad.PicGallery_Loaded;
         }
-
     }
 }

+ 1 - 1
PicView/UI/UserControls/Gallery/PicGalleryItem.xaml

@@ -32,4 +32,4 @@
                 Stretch="UniformToFill" />
         </Border>
     </Border>
-</UserControl>
+</UserControl>

+ 1 - 1
PicView/UI/UserControls/Gallery/PicGalleryItem.xaml.cs

@@ -51,4 +51,4 @@ namespace PicView.UI.UserControls
             }
         }
     }
-}
+}

+ 1 - 3
PicView/UI/UserControls/Menus/FileMenu.xaml

@@ -212,9 +212,7 @@
                         <SolidColorBrush x:Name="SaveBorderBrush" Color="{StaticResource BackgroundColorAlt}" />
                     </Border.Background>
                 </Border>
-
             </Canvas>
-
         </Border>
         <Rectangle
             Width="22"
@@ -230,4 +228,4 @@
             Stroke="{StaticResource BorderBrush}"
             StrokeThickness="2" />
     </StackPanel>
-</UserControl>
+</UserControl>

+ 1 - 1
PicView/UI/UserControls/Menus/FileMenu.xaml.cs

@@ -45,4 +45,4 @@ namespace PicView.UI.UserControls
             FileLocationBorder.MouseLeave += (s, x) => ButtonMouseLeaveAnimBgColor(FileLocationBorderBrush);
         }
     }
-}
+}

+ 1 - 9
PicView/UI/UserControls/Menus/ImageSettings.xaml

@@ -138,9 +138,6 @@
                         Stretch="Fill" />
                 </Button>
 
-
-
-
                 <CheckBox
                     x:Name="FlipButton"
                     Canvas.Left="153"
@@ -249,12 +246,7 @@
                         <SolidColorBrush x:Name="ContainedBorderBrush" Color="{StaticResource BackgroundColorAlt}" />
                     </Border.Background>
                 </Border>
-
-
-
-
             </Canvas>
-
         </Border>
         <Rectangle
             Width="22"
@@ -270,4 +262,4 @@
             Stroke="{StaticResource BorderBrush}"
             StrokeThickness="2" />
     </StackPanel>
-</UserControl>
+</UserControl>

Some files were not shown because too many files changed in this diff