diff --git a/src/MaaWpfGui/Helper/WindowManager.cs b/src/MaaWpfGui/Helper/WindowManager.cs index d20f22a909..cc4b748fc3 100644 --- a/src/MaaWpfGui/Helper/WindowManager.cs +++ b/src/MaaWpfGui/Helper/WindowManager.cs @@ -16,6 +16,7 @@ using System.Globalization; using System.Linq; using System.Windows; using MaaWpfGui.Constants; +using MaaWpfGui.Views.UI; using Stylet; using Screen = System.Windows.Forms.Screen; @@ -38,8 +39,6 @@ namespace MaaWpfGui.Helper private readonly double Width = double.Parse(ConfigurationHelper.GetValue(ConfigurationKeys.WindowWidth, DefaultDouble.ToString(CultureInfo.InvariantCulture)), CultureInfo.InvariantCulture); private readonly double Height = double.Parse(ConfigurationHelper.GetValue(ConfigurationKeys.WindowHeight, DefaultDouble.ToString(CultureInfo.InvariantCulture)), CultureInfo.InvariantCulture); - private readonly string RootView = "MaaWpfGui.RootView"; - public void MoveWindowToDisplay(string displayName, Window window) { var screen = Screen.AllScreens.FirstOrDefault(x => x.DeviceName == displayName); @@ -73,7 +72,7 @@ namespace MaaWpfGui.Helper // In Stylet, CreateWindow().WindowStartupLocation is CenterScreen or CenterOwner (if w.WSLoc == Manual && w.Left == NaN && w.Top == NaN && ...) window.WindowStartupLocation = WindowStartupLocation.Manual; - if (window.ToString() == RootView) + if (window is RootView) { MoveWindowToDisplay(ScreenName, window); } diff --git a/src/MaaWpfGui/Services/Web/HttpService.cs b/src/MaaWpfGui/Services/Web/HttpService.cs index 70635950ae..e84ff016f6 100644 --- a/src/MaaWpfGui/Services/Web/HttpService.cs +++ b/src/MaaWpfGui/Services/Web/HttpService.cs @@ -31,7 +31,19 @@ namespace MaaWpfGui.Services.Web { private const string UserAgent = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/97.0.4692.99 Safari/537.36 Edg/97.0.1072.76"; - private static string Proxy => ConfigurationHelper.GetValue(ConfigurationKeys.UpdateProxy, string.Empty); + private static string Proxy + { + get + { + var p = ConfigurationHelper.GetValue(ConfigurationKeys.UpdateProxy, string.Empty); + if (string.IsNullOrEmpty(p)) + { + return string.Empty; + } + + return p.Contains("://") ? p : $"http://{p}"; + } + } private readonly ILogger _logger = Log.ForContext();