mirror of
https://github.com/BeyondDimension/SteamTools.git
synced 2026-10-26 03:59:34 +08:00
进行中:Steam 快速登录
This commit is contained in:
@@ -46,10 +46,15 @@ namespace System.Application.UI.Views.Controls
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 在浏览器中打开新窗口
|
||||
/// 在浏览器中打开新窗口,所有新页面打开的Url会在浏览器中打开
|
||||
/// </summary>
|
||||
public bool OpenInBrowser { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// 是否固定单页,为 <see langword="true"/> 时所有跳转都将在浏览器中打开
|
||||
/// </summary>
|
||||
public bool FixedSinglePage { get; set; } = false;
|
||||
|
||||
/// <summary>
|
||||
/// 需要拦截响应流的Url
|
||||
/// </summary>
|
||||
@@ -170,6 +175,11 @@ namespace System.Application.UI.Views.Controls
|
||||
|
||||
protected override bool OnBeforePopup(CefBrowser browser, CefFrame frame, string targetUrl, string targetFrameName, CefWindowOpenDisposition targetDisposition, bool userGesture, CefPopupFeatures popupFeatures, CefWindowInfo windowInfo, ref CefClient client, CefBrowserSettings settings, ref CefDictionaryValue extraInfo, ref int noJavascriptAccess)
|
||||
{
|
||||
if (webView.FixedSinglePage)
|
||||
{
|
||||
BrowserOpen(targetUrl);
|
||||
return true;
|
||||
}
|
||||
switch (targetDisposition)
|
||||
{
|
||||
case CefWindowOpenDisposition.NewForegroundTab:
|
||||
@@ -183,7 +193,10 @@ namespace System.Application.UI.Views.Controls
|
||||
else
|
||||
{
|
||||
// 禁止创建新窗口,仅在当前窗口跳转
|
||||
browser.MainFrame.LoadUrl(targetUrl);
|
||||
if (IsHttpUrl(targetUrl))
|
||||
{
|
||||
browser.MainFrame.LoadUrl(targetUrl);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace System.Application.UI.Views.Windows
|
||||
base.OnDataContextChanged(e);
|
||||
if (DataContext is WebView3WindowViewModel vm)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(vm.Title)) webView.DocumentTitleChanged -= WebView_DocumentTitleChanged;
|
||||
vm.WhenAnyValue(x => x.Url).WhereNotNull().Subscribe(x =>
|
||||
{
|
||||
if (x == WebView3WindowViewModel.AboutBlank)
|
||||
@@ -56,10 +57,8 @@ namespace System.Application.UI.Views.Windows
|
||||
}
|
||||
}
|
||||
}).AddTo(vm);
|
||||
vm.WhenAnyValue(x => x.StreamResponseFilterUrls).Subscribe(x =>
|
||||
{
|
||||
webView.StreamResponseFilterUrls = x;
|
||||
}).AddTo(vm);
|
||||
vm.WhenAnyValue(x => x.StreamResponseFilterUrls).Subscribe(x => webView.StreamResponseFilterUrls = x).AddTo(vm);
|
||||
vm.WhenAnyValue(x => x.FixedSinglePage).Subscribe(x => webView.FixedSinglePage = x).AddTo(vm);
|
||||
webView.OnStreamResponseFilterResourceLoadComplete += vm.OnStreamResponseFilterResourceLoadComplete;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ using System.Linq;
|
||||
using System.Security;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using static Newtonsoft.Json.JsonConvert;
|
||||
|
||||
namespace System.Application.UI.ViewModels
|
||||
@@ -209,15 +210,34 @@ namespace System.Application.UI.ViewModels
|
||||
DebugString = @string.ToString();
|
||||
}
|
||||
|
||||
public async void ShowDialogButton_Click()
|
||||
public /*async*/ void ShowDialogButton_Click()
|
||||
{
|
||||
DI.Get<IDesktopPlatformService>().OpenDesktopIconsSettings();
|
||||
#if DEBUG
|
||||
var apiBaseUrl = ICloudServiceClient.Instance.ApiBaseUrl;
|
||||
var vm = new WebView3WindowViewModel
|
||||
{
|
||||
Url = apiBaseUrl + "/ExternalLogin",
|
||||
StreamResponseFilterUrls = new[]
|
||||
{
|
||||
apiBaseUrl + "/ExternalLoginCallback"
|
||||
},
|
||||
OnStreamResponseFilterResourceLoadComplete = (url, data) =>
|
||||
{
|
||||
|
||||
ToastService.Current.Notify("中文测试繁體測試🎉🧨🎇🎆🎄🖼🖼🖼🖼");
|
||||
DebugString += ToastService.Current.Message + Environment.NewLine;
|
||||
DebugString += ToastService.Current.IsVisible + Environment.NewLine;
|
||||
},
|
||||
FixedSinglePage = true,
|
||||
Title = "Steam 快速登录",
|
||||
};
|
||||
IShowWindowService.Instance.Show(CustomWindow.WebView3, vm, resizeMode: ResizeModeCompat.NoResize);
|
||||
#endif
|
||||
|
||||
await IShowWindowService.Instance.Show(typeof(object), CustomWindow.NewVersion);
|
||||
//DI.Get<IDesktopPlatformService>().OpenDesktopIconsSettings();
|
||||
|
||||
//ToastService.Current.Notify("中文测试繁體測試🎉🧨🎇🎆🎄🖼🖼🖼🖼");
|
||||
//DebugString += ToastService.Current.Message + Environment.NewLine;
|
||||
//DebugString += ToastService.Current.IsVisible + Environment.NewLine;
|
||||
|
||||
//await IShowWindowService.Instance.Show(typeof(object), CustomWindow.NewVersion);
|
||||
|
||||
// var r = await MessageBoxCompat.ShowAsync(@"Steam++ v1.1.2 2021-01-29
|
||||
//更新内容
|
||||
|
||||
@@ -21,5 +21,7 @@ namespace System.Application.UI.ViewModels
|
||||
}
|
||||
|
||||
public Action<string, byte[]>? OnStreamResponseFilterResourceLoadComplete { get; set; }
|
||||
|
||||
public bool FixedSinglePage { get; set; }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user