Skip to content

Commit 109490e

Browse files
committed
Fix loading locale from POEditor web API
1 parent 3ef3cd3 commit 109490e

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/Localization.cs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
using System.Linq;
1111
using System.Net.Http;
1212
using System.Reflection;
13-
using System.Threading.Tasks;
1413
using System.Windows.Forms;
1514

1615
namespace WinDynamicDesktop
@@ -61,7 +60,7 @@ public static void Initialize()
6160
}
6261
else
6362
{
64-
LoadLocaleFromWeb().Wait();
63+
LoadLocaleFromWeb();
6564
}
6665

6766
if (JsonConfig.firstRun)
@@ -146,7 +145,7 @@ public static void NotifyIfTestMode()
146145
}
147146
}
148147

149-
private static async Task LoadLocaleFromWeb()
148+
private static void LoadLocaleFromWeb()
150149
{
151150
var client = new RestClient("https://api.poeditor.com");
152151

@@ -156,15 +155,15 @@ private static async Task LoadLocaleFromWeb()
156155
request.AddParameter("language", currentLocale);
157156
request.AddParameter("type", "mo");
158157

159-
var response = await client.ExecuteAsync<PoEditorApiData>(request);
158+
var response = client.Execute<PoEditorApiData>(request);
160159
if (!response.IsSuccessful)
161160
{
162161
return;
163162
}
164163

165164
using (HttpClient httpClient = new HttpClient())
166165
{
167-
byte[] moBinary = await httpClient.GetByteArrayAsync(response.Data.result.url);
166+
byte[] moBinary = httpClient.GetByteArrayAsync(response.Data.result.url).Result;
168167

169168
using (Stream stream = new MemoryStream(moBinary))
170169
{

0 commit comments

Comments
 (0)