From c5dd19ef300acc396c2a0d037ebb52f5aa288864 Mon Sep 17 00:00:00 2001 From: Jack251970 <1160210343@qq.com> Date: Sun, 29 Jun 2025 16:03:19 +0800 Subject: [PATCH] Use Microsoft.Win32.OpenFileDialog instead --- .../ViewModels/SettingsPanePluginStoreViewModel.cs | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs index bce7201b8..2b12ba70f 100644 --- a/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs +++ b/Flow.Launcher/SettingPages/ViewModels/SettingsPanePluginStoreViewModel.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; -using System.Windows.Forms; using CommunityToolkit.Mvvm.Input; using Flow.Launcher.Helper; using Flow.Launcher.Plugin; @@ -112,7 +111,7 @@ public partial class SettingsPanePluginStoreViewModel : BaseModel private static string GetFileFromDialog(string title, string filter = "") { - var dlg = new OpenFileDialog + var dlg = new Microsoft.Win32.OpenFileDialog { InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\Downloads", Multiselect = false, @@ -121,12 +120,11 @@ public partial class SettingsPanePluginStoreViewModel : BaseModel Title = title, Filter = filter }; + var result = dlg.ShowDialog(); + if (result == true) + return dlg.FileName; - return dlg.ShowDialog() switch - { - DialogResult.OK => dlg.FileName, - _ => string.Empty - }; + return string.Empty; } public bool SatisfiesFilter(PluginStoreItemViewModel plugin)