Skip to content

Commit 424d757

Browse files
committed
Add Task.Run due to the change of async download
1 parent c55e889 commit 424d757

File tree

1 file changed

+13
-11
lines changed
  • Plugins/Flow.Launcher.Plugin.PluginManagement

1 file changed

+13
-11
lines changed

Plugins/Flow.Launcher.Plugin.PluginManagement/Main.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ private List<Result> ResultForInstallPlugin(Query query)
144144
IcoPath = "Images\\plugin.png",
145145
TitleHighlightData = StringMatcher.FuzzySearch(query.SecondSearch, r.name).MatchData,
146146
SubTitleHighlightData = StringMatcher.FuzzySearch(query.SecondSearch, r.description).MatchData,
147-
Action = c =>
147+
Action = _ =>
148148
{
149149
MessageBoxResult result = MessageBox.Show("Are you sure you wish to install the \'" + r.name + "\' plugin",
150150
"Install plugin", MessageBoxButton.YesNo);
@@ -157,17 +157,19 @@ private List<Result> ResultForInstallPlugin(Query query)
157157

158158
string pluginUrl = APIBASE + "/media/" + r1.plugin_file;
159159

160-
try
160+
Task.Run(async () =>
161161
{
162-
Http.Download(pluginUrl, filePath);
163-
}
164-
catch (WebException e)
165-
{
166-
context.API.ShowMsg($"PluginManagement.ResultForInstallPlugin: download failed for <{r.name}>");
167-
Log.Exception($"|PluginManagement.ResultForInstallPlugin|download failed for <{r.name}>", e);
168-
return false;
169-
}
170-
context.API.InstallPlugin(filePath);
162+
try
163+
{
164+
await Http.Download(pluginUrl, filePath);
165+
context.API.InstallPlugin(filePath);
166+
}
167+
catch (WebException e)
168+
{
169+
context.API.ShowMsg($"PluginManagement.ResultForInstallPlugin: download failed for <{r.name}>");
170+
Log.Exception($"|PluginManagement.ResultForInstallPlugin|download failed for <{r.name}>", e);
171+
}
172+
});
171173
}
172174
return false;
173175
}

0 commit comments

Comments
 (0)