From ccbdff89f1c4f6724658896206314d6543ff1d61 Mon Sep 17 00:00:00 2001 From: Mark Bassily Date: Mon, 16 Feb 2026 00:06:12 -0500 Subject: [PATCH 1/6] Fix desync between chevron and animation --- .gitignore | 3 +- DeskFrame/DeskFrameWindow.xaml.cs | 60 +++++++++++++++++++------------ 2 files changed, 40 insertions(+), 23 deletions(-) diff --git a/.gitignore b/.gitignore index 9491a2f..2053722 100644 --- a/.gitignore +++ b/.gitignore @@ -360,4 +360,5 @@ MigrationBackup/ .ionide/ # Fody - auto-generated XML schema -FodyWeavers.xsd \ No newline at end of file +FodyWeavers.xsd +/.idea diff --git a/DeskFrame/DeskFrameWindow.xaml.cs b/DeskFrame/DeskFrameWindow.xaml.cs index 53b7519..7fc4f36 100644 --- a/DeskFrame/DeskFrameWindow.xaml.cs +++ b/DeskFrame/DeskFrameWindow.xaml.cs @@ -104,6 +104,7 @@ public int ItemPerRow private bool _fixIsOnBottomInit = true; private bool _didFixIsOnBottom = false; private bool _isMinimized = false; + private bool _animLock = false; private bool _isIngrid = true; private bool _grabbedOnLeft; private int _snapDistance = 8; @@ -1757,37 +1758,52 @@ private void AnimateChevron(bool flip, bool onLoad, double animationSpeed) rotateTransform.BeginAnimation(RotateTransform.AngleProperty, rotateAnimation); } - private void Minimize_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) + private async void Minimize_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) { - - AnimateChevron(_isMinimized, false, Instance.AnimationSpeed); + if (_animLock) return; + + // Check if we even can minimize before locking if (showFolder.Visibility == Visibility.Hidden && showFolderInGrid.Visibility == Visibility.Hidden) { return; } - if (!_isMinimized) + + _animLock = true; + + try { - _originalHeight = this.ActualHeight; - _isMinimized = true; - Instance.Minimized = true; - // Debug.WriteLine("minimize: " + Instance.Height); - AnimateWindowHeight(titleBar.Height, Instance.AnimationSpeed); + _isMinimized = !_isMinimized; + Instance.Minimized = _isMinimized; + + AnimateChevron(_isMinimized, false, Instance.AnimationSpeed); + + if (_isMinimized) + { + _originalHeight = this.ActualHeight; + AnimateWindowHeight(titleBar.Height, Instance.AnimationSpeed); + } + else + { + WindowBackground.CornerRadius = new CornerRadius( + topLeft: WindowBackground.CornerRadius.TopLeft, + topRight: WindowBackground.CornerRadius.TopRight, + bottomRight: 5.0, + bottomLeft: 5.0 + ); + AnimateWindowHeight(Instance.Height, Instance.AnimationSpeed); + } + + HandleWindowMove(false); + + var waitTime = (int)((0.2 / Math.Max(0.01, Instance.AnimationSpeed)) * 1000) + 50; + + await Task.Delay(waitTime); } - else + finally { - WindowBackground.CornerRadius = new CornerRadius( - topLeft: WindowBackground.CornerRadius.TopLeft, - topRight: WindowBackground.CornerRadius.TopRight, - bottomRight: 5.0, - bottomLeft: 5.0 - ); - _isMinimized = false; - Instance.Minimized = false; - - // Debug.WriteLine("unminimize: " + Instance.Height); - AnimateWindowHeight(Instance.Height, Instance.AnimationSpeed); + // Always unlock, even if an error occurred + _animLock = false; } - HandleWindowMove(false); } private void ToggleFileExtension_MouseLeftButtonDown(object sender, MouseButtonEventArgs e) From 3426cfafcba14ac5b835a80064165582c64b24cd Mon Sep 17 00:00:00 2001 From: Mark Bassily Date: Mon, 16 Feb 2026 09:40:09 -0500 Subject: [PATCH 2/6] Optimized dropdown --- DeskFrame/DeskFrameWindow.xaml | 140 +++++++++++++++--------------- DeskFrame/DeskFrameWindow.xaml.cs | 13 +-- 2 files changed, 79 insertions(+), 74 deletions(-) diff --git a/DeskFrame/DeskFrameWindow.xaml b/DeskFrame/DeskFrameWindow.xaml index 56da1b4..8d17191 100644 --- a/DeskFrame/DeskFrameWindow.xaml +++ b/DeskFrame/DeskFrameWindow.xaml @@ -66,9 +66,9 @@ + MouseLeftButtonDown="FileItem_LeftMouseButtonDown" + MouseEnter="FileItem_MouseEnter" MouseLeave="FileItem_MouseLeave" + BorderThickness="1" MouseRightButtonDown="FileItem_RightClick"> + SnapsToDevicePixels="True" + RenderOptions.BitmapScalingMode="NearestNeighbor" + UseLayoutRounding="True" + Width="{Binding DataContext.Instance.IconSize, RelativeSource={RelativeSource AncestorType=Window}, Converter={StaticResource IconSizeToHeightWidthConverter}}" + Height="{Binding DataContext.Instance.IconSize, RelativeSource={RelativeSource AncestorType=Window}, Converter={StaticResource IconSizeToHeightWidthConverter}}" + VerticalAlignment="Center" HorizontalAlignment="Center"/> + + - - - - - - - - - - + + + + + + + + + + + + + + + + + + + TextWrapping="Wrap" TextAlignment="Center" + FontFamily="{DynamicResource ItemFont}" + TextTrimming="{Binding TextTrimming}" + HorizontalAlignment="Center" MaxHeight="{Binding MaxHeight}" + Foreground="{Binding DataContext.Instance.ListViewFontColor, RelativeSource={RelativeSource AncestorType=Window}}" + /> + - - - - - - - - - - + + + + + - - - - + diff --git a/DeskFrame/DeskFrameWindow.xaml.cs b/DeskFrame/DeskFrameWindow.xaml.cs index 7fc4f36..1a4e500 100644 --- a/DeskFrame/DeskFrameWindow.xaml.cs +++ b/DeskFrame/DeskFrameWindow.xaml.cs @@ -2249,6 +2249,7 @@ public async void LoadFiles(string path) loadFilesCancellationToken.Dispose(); loadFilesCancellationToken = new CancellationTokenSource(); CancellationToken loadFiles_cts = loadFilesCancellationToken.Token; + var fileFilterHideRegex = new Regex(Instance.FileFilterHideRegex); try { if (!Directory.Exists(path)) @@ -2268,7 +2269,7 @@ public async void LoadFiles(string path) var files = dirInfo.GetFiles(); var directories = dirInfo.GetDirectories(); _folderCount = directories.Count(); - _fileCount = dirInfo.GetFiles().Count().ToString(); + _fileCount = files.Count().ToString(); _folderSize = !Instance.CheckFolderSize ? "" : Task.Run(() => BytesToStringAsync(dirInfo.EnumerateFiles("*", SearchOption.AllDirectories).Sum(file => file.Length))).Result; var filteredFiles = files.Cast() .Concat(directories) .OrderBy(entry => entry.Name, StringComparer.OrdinalIgnoreCase) @@ -2339,7 +2340,8 @@ await Dispatcher.InvokeAsync(async () => return; } - var existingItem = FileItems.FirstOrDefault(item => item.FullPath == entry.FullName); + var existingLookup = FileItems + .ToDictionary(f => f.FullPath, f => f); long size = 0; if (entry is FileInfo fileInfo) @@ -2354,10 +2356,11 @@ await Dispatcher.InvokeAsync(async () => var thumbnail = await GetThumbnailAsync(entry.FullName); bool isFile = entry is FileInfo; string actualExt = isFile ? Path.GetExtension(entry.Name) : string.Empty; - if (existingItem == null) + + if (!existingLookup.TryGetValue(entry.FullName, out var existingItem)) { if (!string.IsNullOrEmpty(Instance.FileFilterHideRegex) && - new Regex(Instance.FileFilterHideRegex).IsMatch(entry.Name)) + fileFilterHideRegex.IsMatch(entry.Name)) { continue; } @@ -2398,7 +2401,7 @@ await Dispatcher.InvokeAsync(async () => foreach (var fileItem in sortedList) { if (Instance.FileFilterHideRegex != null && Instance.FileFilterHideRegex != "" - && new Regex(Instance.FileFilterHideRegex).IsMatch(fileItem.Name)) + && fileFilterHideRegex.IsMatch(fileItem.Name)) { continue; } From 2e4b414efd342f1a514ff57a0ca6d8721907b343 Mon Sep 17 00:00:00 2001 From: Mark Bassily Date: Mon, 16 Feb 2026 10:01:37 -0500 Subject: [PATCH 3/6] Removed changes from .gitignore --- .gitignore | 1 - 1 file changed, 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2053722..eaa9902 100644 --- a/.gitignore +++ b/.gitignore @@ -361,4 +361,3 @@ MigrationBackup/ # Fody - auto-generated XML schema FodyWeavers.xsd -/.idea From 15fc543a64b38e2aa3ab370630b85fb26cc0c8d0 Mon Sep 17 00:00:00 2001 From: Mark Bassily Date: Mon, 16 Feb 2026 10:29:56 -0500 Subject: [PATCH 4/6] Fix animation lock issue when AnimationSpeed is off --- DeskFrame/DeskFrameWindow.xaml.cs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/DeskFrame/DeskFrameWindow.xaml.cs b/DeskFrame/DeskFrameWindow.xaml.cs index 1a4e500..40fdebe 100644 --- a/DeskFrame/DeskFrameWindow.xaml.cs +++ b/DeskFrame/DeskFrameWindow.xaml.cs @@ -1795,9 +1795,17 @@ private async void Minimize_MouseLeftButtonDown(object sender, MouseButtonEventA HandleWindowMove(false); - var waitTime = (int)((0.2 / Math.Max(0.01, Instance.AnimationSpeed)) * 1000) + 50; + + + var waitTime = 50; + if (Instance.AnimationSpeed > 0) + { + waitTime += (int)((0.2 / Instance.AnimationSpeed) * 1000); + } + await Task.Delay(waitTime); + } finally { From d4b9925da5e95ea95bd0832f74a5f946821921b3 Mon Sep 17 00:00:00 2001 From: Mark Bassily Date: Mon, 16 Feb 2026 10:54:07 -0500 Subject: [PATCH 5/6] Fix moved existingLookup outside of loop --- DeskFrame/DeskFrameWindow.xaml.cs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/DeskFrame/DeskFrameWindow.xaml.cs b/DeskFrame/DeskFrameWindow.xaml.cs index 40fdebe..7cdcbe6 100644 --- a/DeskFrame/DeskFrameWindow.xaml.cs +++ b/DeskFrame/DeskFrameWindow.xaml.cs @@ -2339,7 +2339,7 @@ await Dispatcher.InvokeAsync(async () => FileItems.RemoveAt(i); } } - + var existingLookup = FileItems.ToDictionary(f => f.FullPath, f => f); foreach (var entry in fileEntries) { if (loadFiles_cts.IsCancellationRequested) @@ -2348,8 +2348,6 @@ await Dispatcher.InvokeAsync(async () => return; } - var existingLookup = FileItems - .ToDictionary(f => f.FullPath, f => f); long size = 0; if (entry is FileInfo fileInfo) From d5b93c05275946db51929decde496b415e76b8f9 Mon Sep 17 00:00:00 2001 From: Mark Bassily Date: Mon, 16 Feb 2026 11:22:48 -0500 Subject: [PATCH 6/6] Fix add back null check when creating fileFilterHideRegex --- DeskFrame/DeskFrameWindow.xaml.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/DeskFrame/DeskFrameWindow.xaml.cs b/DeskFrame/DeskFrameWindow.xaml.cs index 7cdcbe6..60f4ecb 100644 --- a/DeskFrame/DeskFrameWindow.xaml.cs +++ b/DeskFrame/DeskFrameWindow.xaml.cs @@ -2257,7 +2257,9 @@ public async void LoadFiles(string path) loadFilesCancellationToken.Dispose(); loadFilesCancellationToken = new CancellationTokenSource(); CancellationToken loadFiles_cts = loadFilesCancellationToken.Token; - var fileFilterHideRegex = new Regex(Instance.FileFilterHideRegex); + var fileFilterHideRegex = string.IsNullOrEmpty(Instance.FileFilterHideRegex) + ? null + : new Regex(Instance.FileFilterHideRegex); try { if (!Directory.Exists(path)) @@ -2365,8 +2367,7 @@ await Dispatcher.InvokeAsync(async () => if (!existingLookup.TryGetValue(entry.FullName, out var existingItem)) { - if (!string.IsNullOrEmpty(Instance.FileFilterHideRegex) && - fileFilterHideRegex.IsMatch(entry.Name)) + if (fileFilterHideRegex?.IsMatch(entry.Name) == true) { continue; } @@ -2406,8 +2407,7 @@ await Dispatcher.InvokeAsync(async () => FileItems.Clear(); foreach (var fileItem in sortedList) { - if (Instance.FileFilterHideRegex != null && Instance.FileFilterHideRegex != "" - && fileFilterHideRegex.IsMatch(fileItem.Name)) + if (fileFilterHideRegex?.IsMatch(fileItem.Name) == true) { continue; }