MainWindow.xaml.cs
(开头部分) 5KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using HtmlAgilityPack;
using Microsoft.Web.WebView2.Core;
using PuppeteerSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace WangZheRongYao
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
string ImagesPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "images");
static int Port = 9222;
static Browser Browser1;
static PuppeteerSharp.Page Currentpage;
public MainWindow()
{
InitializeComponent();
webView2.CoreWebView2InitializationCompleted += WebView2_CoreWebView2InitializationCompleted;
Initialize();
if (!System.IO.Directory.Exists(ImagesPath))
{
System.IO.Directory.CreateDirectory(ImagesPath);
}
}
private void CoreWebView2_NewWindowRequested(object? sender, CoreWebView2NewWindowRequestedEventArgs e)
{
e.Handled = true;
}
/// <summary>
/// WebView2初始化
/// </summary>
async void Initialize()
{
var result = await CoreWebView2Environment.CreateAsync(null, System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "cache"),
new CoreWebView2EnvironmentOptions($"--remote-debugging-port={Port}"));
await webView2.EnsureCoreWebView2Async(result);
webView2.CoreWebView2.NewWindowRequested += CoreWebView2_NewWindowRequested;
}
private async void WebView2_CoreWebView2InitializationCompleted(object? sender, CoreWebView2InitializationCompletedEventArgs e)
{
Browser1 = await PuppeteerSharpHelper.GetBrowser(Port, (int)this.Height, (int)this.Width);
var pages = await Browser1.PagesAsync();
后面还有 71 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。