Add api to Http.cs & message shown up when error thrown

This commit is contained in:
弘韬 张 2021-02-22 12:11:02 +08:00
parent d0168b698c
commit cfbdf294bb
2 changed files with 11 additions and 2 deletions

View file

@ -9,6 +9,8 @@ using Flow.Launcher.Infrastructure.UserSettings;
using System;
using System.ComponentModel;
using System.Threading;
using System.Windows.Interop;
using Flow.Launcher.Plugin;
namespace Flow.Launcher.Infrastructure.Http
{
@ -18,6 +20,8 @@ namespace Flow.Launcher.Infrastructure.Http
private static HttpClient client = new HttpClient();
public static IPublicAPI _api { get; set; }
static Http()
{
// need to be added so it would work on a win10 machine
@ -77,7 +81,9 @@ namespace Flow.Launcher.Infrastructure.Http
}
catch(UriFormatException e)
{
Log.Exception("Http", "Unable to parse Uri", e);
_api.ShowMsg("Please try again", "Unable to parse Http Proxy");
Log.Exception("Flow.Launcher.Infrastructure.Http", "Unable to parse Uri", e);
}
}

View file

@ -61,7 +61,6 @@ namespace Flow.Launcher
_settingsVM = new SettingWindowViewModel(_updater, _portable);
_settings = _settingsVM.Settings;
Http.Proxy = _settings.Proxy;
_alphabet.Initialize(_settings);
_stringMatcher = new StringMatcher(_alphabet);
@ -74,6 +73,10 @@ namespace Flow.Launcher
await PluginManager.InitializePlugins(API);
var window = new MainWindow(_settings, _mainVM);
Http._api = API;
Http.Proxy = _settings.Proxy;
Log.Info($"|App.OnStartup|Dependencies Info:{ErrorReporting.DependenciesInfo()}");
Current.MainWindow = window;