Change the place of Wait in PluginManifest to make code more elegent

This commit is contained in:
张弘韬 2020-12-21 19:42:50 +08:00
parent 85f5766022
commit 96609f797e

View file

@ -10,21 +10,19 @@ namespace Flow.Launcher.Plugin.PluginsManager.Models
internal class PluginsManifest
{
internal List<UserPlugin> UserPlugins { get; private set; }
internal PluginsManifest()
{
DownloadManifest();
DownloadManifest().Wait();
}
private void DownloadManifest()
private async Task DownloadManifest()
{
var json = string.Empty;
try
{
var t = Task.Run(
async () =>
json = await Http.Get("https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json"));
t.Wait();
json = await Http.Get(
"https://raw.githubusercontent.com/Flow-Launcher/Flow.Launcher.PluginsManifest/main/plugins.json");
UserPlugins = JsonConvert.DeserializeObject<List<UserPlugin>>(json);
}
@ -34,7 +32,6 @@ namespace Flow.Launcher.Plugin.PluginsManager.Models
UserPlugins = new List<UserPlugin>();
}
}
}
}
}