From 9ab146944dec51e6264c37ad1128738405cd67ab Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:19:47 +0000 Subject: [PATCH 1/3] Initial plan From ac969f45daaf0696578804ccb7e77afbd74380e5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:26:46 +0000 Subject: [PATCH 2/3] Implement smart folder suggestion for icon save dialogs Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com> --- .../Views/MainPage.xaml.cs | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) diff --git a/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs b/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs index 4d59356..07806fc 100644 --- a/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs +++ b/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs @@ -25,6 +25,7 @@ public sealed partial class MainPage : Page private readonly DispatcherTimer dispatcherTimer = new(); private string ImagePath = ""; private string OutPutPath = ""; + private string LastUsedOutputFolder = ""; private readonly UndoRedo undoRedo = new(); public MainViewModel ViewModel { get; } @@ -154,6 +155,7 @@ private async void ClearAppBarButton_Click(object sender, RoutedEventArgs e) { MainImage.Source = null; ImagePath = "-"; + LastUsedOutputFolder = ""; foreach (UIElement? item in PreviewsGrid.Children) if (item is PreviewStack stack) @@ -454,6 +456,27 @@ private async void SaveAllBTN_Click(object sender, RoutedEventArgs e) savePicker.DefaultFileExtension = ".ico"; savePicker.SuggestedFileName = Path.GetFileNameWithoutExtension(ImagePath); + // If we have a last used output path, try to set it as the suggested save file + // This will make the picker open in that folder + if (!string.IsNullOrWhiteSpace(OutPutPath) && File.Exists(OutPutPath)) + { + try + { + StorageFile previousFile = await StorageFile.GetFileFromPathAsync(OutPutPath); + savePicker.SuggestedSaveFile = previousFile; + } + catch + { + // If we can't access the previous file, try using the source image folder + await TrySetSuggestedFolderFromSourceImage(savePicker); + } + } + else + { + // No previous output, use the source image folder + await TrySetSuggestedFolderFromSourceImage(savePicker); + } + InitializeWithWindow.Initialize(savePicker, App.MainWindow.WindowHandle); StorageFile file = await savePicker.PickSaveFileAsync(); @@ -462,6 +485,11 @@ private async void SaveAllBTN_Click(object sender, RoutedEventArgs e) return; OutPutPath = file.Path; + + // Remember the output folder for future saves + string? outputFolder = Path.GetDirectoryName(file.Path); + if (!string.IsNullOrWhiteSpace(outputFolder)) + LastUsedOutputFolder = outputFolder; try { @@ -496,6 +524,27 @@ private async void SaveBTN_Click(object sender, RoutedEventArgs e) savePicker.DefaultFileExtension = ".ico"; savePicker.SuggestedFileName = Path.GetFileNameWithoutExtension(ImagePath); + // If we have a last used output path, try to set it as the suggested save file + // This will make the picker open in that folder + if (!string.IsNullOrWhiteSpace(OutPutPath) && File.Exists(OutPutPath)) + { + try + { + StorageFile previousFile = await StorageFile.GetFileFromPathAsync(OutPutPath); + savePicker.SuggestedSaveFile = previousFile; + } + catch + { + // If we can't access the previous file, try using the source image folder + await TrySetSuggestedFolderFromSourceImage(savePicker); + } + } + else + { + // No previous output, use the source image folder + await TrySetSuggestedFolderFromSourceImage(savePicker); + } + InitializeWithWindow.Initialize(savePicker, App.MainWindow.WindowHandle); StorageFile file = await savePicker.PickSaveFileAsync(); @@ -505,6 +554,11 @@ private async void SaveBTN_Click(object sender, RoutedEventArgs e) OutPutPath = Path.Combine(file.Path); + // Remember the output folder for future saves + string? outputFolder = Path.GetDirectoryName(file.Path); + if (!string.IsNullOrWhiteSpace(outputFolder)) + LastUsedOutputFolder = outputFolder; + try { SaveBTN.IsEnabled = false; @@ -744,4 +798,25 @@ private async void OnCountdownCompleted(object? sender, EventArgs e) { await RefreshPreviews(); } + + private async Task TrySetSuggestedFolderFromSourceImage(FileSavePicker savePicker) + { + if (string.IsNullOrWhiteSpace(ImagePath)) + return; + + try + { + // Use the source image file itself to suggest the folder + // This makes the picker open in the source image's folder + if (File.Exists(ImagePath)) + { + StorageFile sourceFile = await StorageFile.GetFileFromPathAsync(ImagePath); + savePicker.SuggestedSaveFile = sourceFile; + } + } + catch + { + // If file access fails, fall back to default picker behavior + } + } } From 70f519ca1a877cd83851bd6fb7e4b455168c9dd4 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 23 Oct 2025 23:28:28 +0000 Subject: [PATCH 3/3] Refine implementation: reset output path when loading new image Co-authored-by: TheJoeFin <7809853+TheJoeFin@users.noreply.github.com> --- .../Simple Icon File Maker/Views/MainPage.xaml.cs | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs b/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs index 07806fc..a06fe54 100644 --- a/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs +++ b/Simple Icon File Maker/Simple Icon File Maker/Views/MainPage.xaml.cs @@ -25,7 +25,6 @@ public sealed partial class MainPage : Page private readonly DispatcherTimer dispatcherTimer = new(); private string ImagePath = ""; private string OutPutPath = ""; - private string LastUsedOutputFolder = ""; private readonly UndoRedo undoRedo = new(); public MainViewModel ViewModel { get; } @@ -155,7 +154,6 @@ private async void ClearAppBarButton_Click(object sender, RoutedEventArgs e) { MainImage.Source = null; ImagePath = "-"; - LastUsedOutputFolder = ""; foreach (UIElement? item in PreviewsGrid.Children) if (item is PreviewStack stack) @@ -275,6 +273,9 @@ private async Task LoadFromImagePath() return; } + // Reset output path when loading a new image so the picker uses the source folder + OutPutPath = ""; + InitialLoadProgressBar.Value = 0; LoadIconSizes(); @@ -485,11 +486,6 @@ private async void SaveAllBTN_Click(object sender, RoutedEventArgs e) return; OutPutPath = file.Path; - - // Remember the output folder for future saves - string? outputFolder = Path.GetDirectoryName(file.Path); - if (!string.IsNullOrWhiteSpace(outputFolder)) - LastUsedOutputFolder = outputFolder; try { @@ -554,11 +550,6 @@ private async void SaveBTN_Click(object sender, RoutedEventArgs e) OutPutPath = Path.Combine(file.Path); - // Remember the output folder for future saves - string? outputFolder = Path.GetDirectoryName(file.Path); - if (!string.IsNullOrWhiteSpace(outputFolder)) - LastUsedOutputFolder = outputFolder; - try { SaveBTN.IsEnabled = false;