Skip to content

Commit 74ea629

Browse files
committed
search window hides when prompted to install, remove threading
1 parent caf200b commit 74ea629

File tree

1 file changed

+5
-18
lines changed

1 file changed

+5
-18
lines changed

Plugins/Flow.Launcher.Plugin.Explorer/Search/Everything/EverythingDownloadHelper.cs

Lines changed: 5 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,18 @@ public static class EverythingDownloadHelper
1313
{
1414
public static async Task<string> PromptDownloadIfNotInstallAsync(string installedLocation, IPublicAPI api)
1515
{
16-
if (installedLocation.FileExists())
17-
return installedLocation;
18-
19-
if (!string.IsNullOrEmpty(installedLocation))
16+
if (!string.IsNullOrEmpty(installedLocation) && installedLocation.FileExists())
2017
return installedLocation;
2118

2219
installedLocation = GetInstalledPath();
2320

2421
if (string.IsNullOrEmpty(installedLocation))
2522
{
26-
// Solves single thread apartment (STA) mode requirement error when using OpenFileDialog
27-
var t = new Thread(() =>
28-
{
29-
if (System.Windows.Forms.MessageBox.Show(
23+
if (System.Windows.Forms.MessageBox.Show(
3024
string.Format(api.GetTranslation("flowlauncher_plugin_everything_installing_select"), Environment.NewLine),
3125
api.GetTranslation("flowlauncher_plugin_everything_installing_title"),
32-
System.Windows.Forms.MessageBoxButtons.YesNo) != System.Windows.Forms.DialogResult.Yes)
33-
return;
34-
26+
System.Windows.Forms.MessageBoxButtons.YesNo) == System.Windows.Forms.DialogResult.Yes)
27+
{
3528
var dlg = new System.Windows.Forms.OpenFileDialog
3629
{
3730
InitialDirectory = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)
@@ -40,13 +33,7 @@ public static async Task<string> PromptDownloadIfNotInstallAsync(string installe
4033
var result = dlg.ShowDialog();
4134
if (result == System.Windows.Forms.DialogResult.OK && !string.IsNullOrEmpty(dlg.FileName))
4235
installedLocation = dlg.FileName;
43-
44-
});
45-
46-
// Run your code from a thread that joins the STA Thread
47-
t.SetApartmentState(ApartmentState.STA);
48-
t.Start();
49-
t.Join();
36+
}
5037
}
5138

5239
if (!string.IsNullOrEmpty(installedLocation))

0 commit comments

Comments
 (0)