Skip to content

Commit a1e8577

Browse files
taoocerosjjw24
authored andcommitted
Add api to Http.cs & message shown up when error thrown
1 parent 4c2e306 commit a1e8577

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Flow.Launcher.Infrastructure/Http/Http.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
using System;
1010
using System.ComponentModel;
1111
using System.Threading;
12+
using System.Windows.Interop;
13+
using Flow.Launcher.Plugin;
1214

1315
namespace Flow.Launcher.Infrastructure.Http
1416
{
@@ -18,6 +20,8 @@ public static class Http
1820

1921
private static HttpClient client = new HttpClient();
2022

23+
public static IPublicAPI _api { get; set; }
24+
2125
static Http()
2226
{
2327
// need to be added so it would work on a win10 machine
@@ -77,7 +81,9 @@ var userName when string.IsNullOrEmpty(userName) =>
7781
}
7882
catch(UriFormatException e)
7983
{
80-
Log.Exception("Http", "Unable to parse Uri", e);
84+
_api.ShowMsg("Please try again", "Unable to parse Http Proxy");
85+
Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
86+
8187
}
8288
}
8389

Flow.Launcher/App.xaml.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
6161
_settingsVM = new SettingWindowViewModel(_updater, _portable);
6262
_settings = _settingsVM.Settings;
6363

64-
Http.Proxy = _settings.Proxy;
6564

6665
_alphabet.Initialize(_settings);
6766
_stringMatcher = new StringMatcher(_alphabet);
@@ -74,6 +73,10 @@ await Stopwatch.NormalAsync("|App.OnStartup|Startup cost", async () =>
7473
await PluginManager.InitializePlugins(API);
7574
var window = new MainWindow(_settings, _mainVM);
7675

76+
Http._api = API;
77+
Http.Proxy = _settings.Proxy;
78+
79+
7780
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
7881

7982
Current.MainWindow = window;

0 commit comments

Comments
 (0)